After using "dumpsys activity" extensively to determine what is
happening to the task activity stack, I have determined that when I
add FLAG_ACTIVITY_NEW_TASK as a flag on my Intent used to switch
between the two tasks in my application, Android is adding another
activity to the stack, instead of just resuming the task in it's prior
state.

For example, if I'm in Task B, and I want to switch to Task A, I do:

Intent i = new Intent(context, RootActivityA.class);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);

The documentation leads me to believe that Android is supposed to
simply resume Task "A" (where RootActivityA is the root of Task A),
and bring me back to where I left off (which was an Activity deeper in
the stack in A, NOT RootActivityA).  But instead what's happening is
that it's adding another RootActivityA to the stack, i.e.

RootActivityA-->Activity A1 --> Activity A2 --> RootActivityA

This is not what I am expecting, considering this is the documentation
for FLAG_ACTIVITY_NEW_TASK:

"When using this flag, if a task is already running for the activity
you are now starting, then a new activity will not be started;
instead, the current task will simply be brought to the front of the
screen with the state it was last in. See FLAG_ACTIVITY_MULTIPLE_TASK
for a flag to disable this behavior."

Does anyone have any idea why Android would be adding another copy of
RootActivityA onto the history stack instead of just resuming the Task
at the last place it left off?

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

Reply via email to