FIXED Unable to find explicit activity class annoying error
<p>I did some research one this Exception but none of these answers here helped me. So what I need to do is when I click a list item, it moves to another activity but I end up getting the same annoying Exception. It tells to look into Android Manifest file but everything is alright there! </p>

<p>Here is my code</p>

<p>Intent:</p>

<pre><code>@Override
public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int position, long id) {
    String strItemTextView = mForecastAdapter.getItem(position);
    Intent intent = new Intent(getActivity(), DetailActivity.class);
    intent.putExtra(Intent.EXTRA_TEXT, strItemTextView);
    startActivity(intent);
}
</code></pre>

<p>And Android Manifest file:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.android.sunshine2"&gt;

    &lt;uses-permission android:name="android.permission.INTERNET" /&gt;

    &lt;application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"&gt;
        &lt;activity
            android:name="com.example.android.sunshine2.MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar"&gt;
            &lt;intent-filter&gt;
                &lt;action android:name="android.intent.action.MAIN" /&gt;

                &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;
        &lt;activity
            android:name="com.example.android.sunshine2.DetailActivity"
            android:label="@string/title_activity_detail"
            android:parentActivityName="com.example.android.sunshine2.MainActivity"
            android:theme="@style/AppTheme.NoActionBar"&gt;
            &lt;meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.example.android.sunshine2.MainActivity" /&gt;
        &lt;/activity&gt;
    &lt;/application&gt;

&lt;/manifest&gt;
</code></pre>

<p>UPDATE:</p>

<p>Here is my code for DetailActivity:</p>

<pre><code>package com.example.android.sunshine2;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBarActivity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;

public class DetailActivity extends ActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_detail);
        if (savedInstanceState == null) {
            getSupportFragmentManager().beginTransaction()
                    .add(R.id.container, new PlaceholderFragment())
                    .commit();
        }
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.detail, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

    /**
     * A placeholder fragment containing a simple view.
     */
    public static class PlaceholderFragment extends Fragment {

        public PlaceholderFragment() {
        }

        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                 Bundle savedInstanceState) {

            View rootView = inflater.inflate(R.layout.fragment_detail, container, false);
            return rootView;
        }
    }
}
</code></pre>

<p>I get an exception like this:</p>

<pre><code>android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.android.sunshine2/com.example.android.sunshine2.DetailActivity}; have you declared this activity in your AndroidManifest.xml?
</code></pre>

<p>And it points to this line of the code:</p>

<pre><code>intent.putExtra(Intent.EXTRA_TEXT, strItemTextView);
</code></pre>

<p>UPDATE  #2:</p>

<p>Now things are getting really weird. If I use relative path for activity name  BUT leave a full path for a Parent activity name (Code snippet of manifest file):</p>

<pre><code>&lt;activity
        android:name=".DetailActivity" // &lt;!--Activity I wanna go to (relative path)--&gt;
        android:label="@string/title_activity_detail"
        android:parentActivityName="com.example.android.sunshine2.MainActivity"
        android:theme="@style/AppTheme.NoActionBar"&gt;
        &lt;meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="com.example.android.sunshine2.MainActivity" /&gt;&lt;!--Full path--&gt;
    &lt;/activity&gt;
</code></pre>

<p>I get the same Exception but this time it points to this line of code:</p>

<pre><code>startActivity(intent);
</code></pre>

<p>UPDATE #3:
Please take a look at the comment I managed to fix my problem</p>