I am programming an app that eventually will have several Activities. Right now, however, I got stuck trying to start the second activity from the first one. For some odd reason I am always only getting an ActivityNotFoundException.
The code that tries to start the second activity reads:
...
Intent intent = new Intent(Intent.ACTION_INSERT);
/* intent.addCategory("foo"); */
Log.v(TAG, "starting activity: " + intent);
startActivity(intent);
...
The Intent.ACTION_INSERT string constant is "android.intent.action.INSERT".
The corresponding fragment in the AndroidManifest.xml reads:
...
<activity
android:label="@string/item_details"
android:name="ItemDetails"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.INSERT" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="foo" />
</intent-filter>
</activity>
...
The Activity class "ItemDetails" exists and is in the same package as the "calling" Activity. The Intent names match and according to the Android docs the "android.intent.category.DEFAULT" category should apply to all Intents that have no category set. Still, that Activity is not found. Why?
I also tried to specify a unique category "foo" as shown in the commented line in the code snippet and also added that to the manifest file, but same result.... :-(
What am I missing? Any hints?