alex2k8 alex2k8 - 2 months ago 5
Android Question

Android: keep task's activity stack after restart from HOME

My application has two activities, that I start in this order:

HOME > A > B

Now I press HOME and launch "A" again. I would like to see activity "B" on a top of "A", but instead I get "A" - so the activity stack is cleared.


<activity android:name=".activity.A" android:label="A" android:alwaysRetainTaskState="true">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />

<activity android:name=".activity.B" android:label="B">

What should I do?


I figured out what is wrong...

The config is right, but I started application for debugging from Eclipse, this was the issue.

Case # 1.

Debug > A > B > HOME > A
Get: A (stack is cleared)

Case # 2.

Debug > A > BACK > A > B > HOME > A
Get: B (stack preserved)

Case # 3.

A > B > HOME > A
Get: B (stack preserved)