In my Android app, I wanted to start action “B” from the initial activity “A”. I created classes for both. However, when using the following code to run B, I get a runtime error: application has stopped unexpectedly, try again . Here is my code:
Intent myIntent = new Intent(this, AddNewActivity.class); startActivity(myIntent);
When I added a new entry to AndroidManifest.xml/manifest/application/activity/intent-filers for action B, then the application worked.
I have two questions:
- When there are several activity entries in
AndroidManifest.xml , how does the android know for what purpose to start over? - I could not understand the filters of intent. Can someone explain.
Here is my partial AndroidManifest.xml
<application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".ListAllActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".AddNewActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application>
android android-intent intentfilter
ankitjaininfo Jul 23 '10 at 19:05 2010-07-23 19:05
source share