My Program stops after 2nd intent in android

2019-07-29 22:57发布

问题:

My android application stops after startActivity () call of my 2nd intent. It works perfectly for the first time with intents. But on the 2nd time its control doesn't pass to 3rd activity. I haven't displayed anything on 2nd activity. Is it the problem? Or is something with my AndroidManifest.xml file? Can some one help me? I have added the intent filter of three activities as shown below.Is it the problem? I am new to android so please help me!

 <intent-filter>
     <action android:name="android.intent.action.MAIN" />
     <category android:name="android.intent.category.LAUNCHER" />
 </intent-filter>

回答1:

For any activity that isn't the main one use the following:

<category android:name="android.intent.category.DEFAULT" /> 

Only the original activity should have the following:

 <category android:name="android.intent.category.LAUNCHER" />