alex2k8 alex2k8 - 1 year ago 100
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?

Answer Source

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)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download