title: ActivityNotFound exception thrown for a PreferenceActivity listed in the Manifest xml
body: <p>I'm trying to implement a <code>PreferenceActivity</code> in my app, but I keep getting an exception of type <code>android.content.ActivityNotFoundException</code>.  It mentions making sure that the Activity is listed in my Manifest file, but it is and I still get the exception.  Thanks in advance for your help--this is has been driving me crazy.</p>
  
  <p>This is a similar posting I found that has a solution, but it didn't work for me:
  <a href="https://stackoverflow.com/questions/2614134/my-preferenceactivity-does-not-show-up-even-though-it-is-in-my-manifest-file">My PreferenceActivity does not show up, even though it is in my manifest file</a></p>
  
  <p>res/xml/preferences.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
          android:title="@string/preferences_title_settings"
          android:key="@string/preferences_key_settings" &gt;
      &lt;PreferenceScreen android:summary="@string/preferences_summary_gameplaySettings"
              android:title="@string/preferences_title_gameplaySettings"
              android:key="@string/preferences_key_gameplaySettings"&gt;            
          &lt;ListPreference android:entries="@array/entries_difficulty"
                  android:entryValues="@array/entryvalues_difficulty"
                  android:dialogTitle="@string/dialog_title_difficulty"
                  android:title="@string/preferences_title_difficulty"
                  android:key="@string/preferences_key_difficulty"
                  android:summary="@string/preferences_summary_difficulty"
                  android:defaultValue="0" /&gt;
          &lt;CheckBoxPreference android:key="@string/preferences_key_autosave"
                  android:title="@string/preferences_title_autosave"
                  android:summary="@string/preferences_summary_autosave" /&gt;
      &lt;/PreferenceScreen&gt;
  &lt;/PreferenceScreen&gt;
  </code></pre>
  
  <p>Preferences.java:</p>
  
  <pre><code>public class Preferences extends PreferenceActivity implements 
      OnSharedPreferenceChangeListener {
          private SharedPreferences preferences;
  
          @Override
          protected void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              this.preferences = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
              addPreferencesFromResource(R.xml.preferences);
              getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this)
          }
      }
  </code></pre>
  
  <p>The 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.areyling.myapp"
        android:versionCode="1"
        android:versionName="@string/app_version" &gt;
      &lt;uses-sdk android:minSdkVersion="4" /&gt;
      &lt;application android:icon="@drawable/icon"
              android:theme="@android:style/Theme.NoTitleBar"
              android:label="@string/app_name"
              android:screenOrientation="portrait" &gt;
          &lt;activity android:name=".Main"
                    android:label="@string/app_name"&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=".Tutorial"
                  android:screenOrientation="portrait"
                  android:configChanges="keyboardHidden|orientation" /&gt;
          &lt;activity android:name=".About" /&gt;
          &lt;activity android:name=".Preferences"
                  android:screenOrientation="portrait"
                  android:theme="@android:style/Theme" /&gt;
      &lt;/application&gt;
  &lt;/manifest&gt;
  </code></pre>
  
  <p>The code attempting to launch the Preferences in Main.java:</p>
  
  <pre><code>Intent preferencesIntent = new Intent(this, Preferences.class);
  startActivity(preferencesIntent);
  </code></pre>
  
  <p>The logcat output:</p>
  
  <pre><code>03-19 16:57:39.365: DEBUG/AndroidRuntime(448): &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; AndroidRuntime START &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;
  03-19 16:57:39.365: DEBUG/AndroidRuntime(448): CheckJNI is ON
  03-19 16:57:39.605: DEBUG/AndroidRuntime(448): --- registering native functions ---
  03-19 16:57:39.935: DEBUG/ddm-heap(448): Got feature list request
  03-19 16:57:41.025: INFO/ActivityManager(52): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.areyling.myapp/.Main }
  03-19 16:57:41.308: DEBUG/AndroidRuntime(448): Shutting down VM
  03-19 16:57:41.308: DEBUG/dalvikvm(448): DestroyJavaVM waiting for non-daemon threads to exit
  03-19 16:57:41.314: DEBUG/dalvikvm(448): DestroyJavaVM shutting VM down
  03-19 16:57:41.314: DEBUG/dalvikvm(448): HeapWorker thread shutting down
  03-19 16:57:41.325: DEBUG/dalvikvm(448): HeapWorker thread has shut down
  03-19 16:57:41.325: DEBUG/jdwp(448): JDWP shutting down net...
  03-19 16:57:41.325: INFO/dalvikvm(448): Debugger has detached; object registry had 1 entries
  03-19 16:57:41.334: DEBUG/dalvikvm(448): VM cleaning up
  03-19 16:57:41.386: ERROR/AndroidRuntime(448): ERROR: thread attach failed
  03-19 16:57:41.395: DEBUG/dalvikvm(448): LinearAlloc 0x0 used 639500 of 5242880 (12%)
  03-19 16:57:41.594: INFO/ActivityManager(52): Start proc com.areyling.myapp for activity com.areyling.myapp/.Main: pid=455 uid=10028 gids={}
  03-19 16:57:41.811: DEBUG/ddm-heap(455): Got feature list request
  03-19 16:57:42.854: DEBUG/(455): unable to unlink '/data/data/com.areyling.myapp/shared_prefs/com.areyling.myapp_preferences.xml.bak': No such file or directory (errno=2)
  03-19 16:57:43.605: INFO/ActivityManager(52): Displayed activity com.areyling.myapp/.Main: 2081 ms (total 2081 ms)
  03-19 16:57:48.834: DEBUG/dalvikvm(207): GC freed 80 objects / 3920 bytes in 105ms
  03-19 16:57:53.905: DEBUG/dalvikvm(100): GC freed 2224 objects / 130960 bytes in 184ms
  03-19 16:57:57.385: INFO/ActivityManager(52): Starting activity: Intent { cmp=com.areyling.myapp/java.util.prefs.Preferences }
  03-19 16:57:57.395: DEBUG/AndroidRuntime(455): Shutting down VM
  03-19 16:57:57.405: WARN/dalvikvm(455): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
  03-19 16:57:57.405: ERROR/AndroidRuntime(455): Uncaught handler: thread main exiting due to uncaught exception
  03-19 16:57:57.434: ERROR/AndroidRuntime(455): java.lang.IllegalStateException: Could not execute method of the activity
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     at android.view.View$1.onClick(View.java:2031)
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     at android.view.View.performClick(View.java:2364)
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     at android.view.View.onTouchEvent(View.java:4179)
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     at android.widget.TextView.onTouchEvent(TextView.java:6541)
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     at android.view.View.dispatchTouchEvent(View.java:3709)
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     at android.app.Activity.dispatchTouchEvent(Activity.java:2061)
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1691)
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     at android.os.Handler.dispatchMessage(Handler.java:99)
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     at android.os.Looper.loop(Looper.java:123)
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     at android.app.ActivityThread.main(ActivityThread.java:4363)
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     at java.lang.reflect.Method.invokeNative(Native Method)
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     at java.lang.reflect.Method.invoke(Method.java:521)
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     at dalvik.system.NativeStart.main(Native Method)
  03-19 16:57:57.434: ERROR/AndroidRuntime(455): Caused by: java.lang.reflect.InvocationTargetException
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     at com.areyling.myapp.Main.settingsButtonClick(Main.java:105)
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     at java.lang.reflect.Method.invokeNative(Native Method)
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     at java.lang.reflect.Method.invoke(Method.java:521)
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     at android.view.View$1.onClick(View.java:2026)
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     ... 21 more
  03-19 16:57:57.434: ERROR/AndroidRuntime(455): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.areyling.myapp/java.util.prefs.Preferences}; have you declared this activity in your AndroidManifest.xml?
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1404)
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     at android.app.Activity.startActivityForResult(Activity.java:2749)
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     at android.app.Activity.startActivity(Activity.java:2855)
  03-19 16:57:57.434: ERROR/AndroidRuntime(455):     ... 25 more
  03-19 16:57:57.484: INFO/Process(52): Sending signal. PID: 455 SIG: 3
  03-19 16:57:57.494: INFO/dalvikvm(455): threadid=7: reacting to signal 3
  </code></pre>