It is understandable that if you have Activities (in the same task)
that can reference each other through startActivity(), that you could
have a circular loop where the user keeps going back/forth between the
Activities, and your Activity stack would keep growing without bound
until it finally ends in Stack Overflow.

Now, what happens if you want your app to consist of two (or more)
separate Tasks, where each Task has it's own Activity stack.  Buttons
(or menus) in the app would allow the user to switch Tasks bring bring
the requested Task to the foregound using Intents with flags
FLAG_ACTIVITY_NEW_TASK and FLAG_ACTIVITY_RESET_TASK_IF_NEEDED (similar
to what the Launcher does when it brings a Task to the front).  Since
each Task has it's own Activity back-stack, there wouldn't be a Stack
Overflow within a Task.  However, what I've noticed when I tried
implementing this is that as you switch Tasks, there seems to be a
"Task Back Stack" within Android, such that if you switch between Task
A, then B, then back to A, (and so on), when you hit the 'back'
button, the system goes back through the history of your Task
switches.  Even though new Activities are not being added to the Task
stack(s), there does seem to be an additional history that contains
the active Tasks.  So it seems as if you could get a different kind of
"Overflow", but with Task switch history, not Activity history.  Can
anyone confirm or deny this?

I would really like my app to have separate Tasks within it.  There
will be a main Task that is associated with the LAUNCHER, and a set of
Activities for viewing data in that stack.  Then, I'd like the user to
be able to switch to different "tabs" in the application where each
Tab has it's own Task and Activity back stack (i.e. the main Task
views financial markets, another Task allows the user to view their
market orders, and drill down into details, a third Task allows the
user to view their market positions, and drill down into details,
etc).  I KNOW I can use TabHost and ActivityGroup, but believe me,
I've tried these approaches and I have had a myriad of problems with
them.  I don't really want to switch views within the Tabs either, I'd
rather have separate Activities so that I can reuse them in other
places, and also because I rely on the Activity lifecycle to subscribe/
unsubscribe to market data and other items.

So in conclusion, my first question revolves around whether I need to
worry about Task switching history overflow, and my other question
revolves around finding the best way to implement this type of
navigation within my app, without resorting to separate LAUNCHER apps
for each Task (I'd like to package up one Application and one LAUNCHER
icon).

-- 
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