Hi,
I'm having trouble with my activities when they go in the background. I have two activities, A and B. Only A can launch B (manifest copied below). This is what I do:
- Launch the app from the app drawer (activity A)
- There's a button on A to launch B, B now is displayed.
- Hit the Home key, my app is now in the background.
- Go to the app drawer again, hit my app icon.
- Instead of resuming at ActivityB, Activity A is launched again. Why?
- If I hit the Back key now, I get shown the old ActivityB. What?
This is very confusing. It's like Android knows my app is running, and puts a new instance of A on top of the old B instance running. I'd just expect that the application gets paused in-place, and whenever the user hits the app icon again, it just picks up where it left off (in this case, just show B again!) Below is the manifest, and the activity classes for this test are completely empty (except A which has a button to launch B).
<activity android:name=".ActivityA"
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=".ActivityB"
android:label="@string/app_name">
<intent-filter>
<!--
<action android:name="android.intent.action.VIEW" />
-->
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>