views:

372

answers:

1

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.

Manifest:

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

<activity android:name=".activity.B" android:label="B">
    <intent-filter>
    </intent-filter>
</activity>

What should I do?

+2  A: 

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)
alex2k8
Ahh, interesting! There have been a lot of questions like this in the past day or two, so maybe that's the answer for some of them :)
Christopher
Note that this behaviour has been fixed in the 0.9.6 release of the ADT plugin for Eclipse. You can now happily launch your apps from Eclipse and get the same behaviour as on a device.
Christopher
Thank you for this information, Christopher!
alex2k8