I have two "launchMode:singleTask" activities in my app.

Activity A (also the MAIN/LAUNCHER Activity);
taskAffinity="Affinity.A"; alwaysRetainTaskState="true"
Activity B (taskAffinity="Affinity.B"; alwaysRetainTaskState="true")

1. When I run the app from the Home Launcher, Activity A starts as
expected.

2. I navigate into Activity A1 from a button in Activity A.  Activity
A1 launches as the second Activity on the main Task's stack, as
expected.

3. When I hit a button on Activity A1 that starts Activity B, Activity
B starts in it's own new Task, as expected (due to singleTask
definition on B).

4. When I click a button in Activity B that does

   startActivity(new Intent(this, ActivityA.class)

the system takes me back to the first (root) activity in Activity A
which is not what I want. I want it to resume the main Task where it
left off in Activity A1.  The documentation for singleTask indicates
the system is supposed to take you back where you left off in the
Task, but this is clearly not happening.  When I hit the back button
from the newly started Activity A, it goes back to Activity B, then
exits the app if I hit it again, so it is definitely not adding
another Activity A on the stack, it is resuming the main Task but just
not getting me back to where I left off.

Am I doing something wrong?  Do I need to ditch launchMode=singleTask
and use FLAG_ACTIVITY_NEW_TASK instead when calling startActivity()?
I found another flag FLAG_ACTIVITY_RESET_TASK_IF_NEEDED, and I'm
confused as to what that is supposed to do, while guessing that it
may(?) help me here?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to