On May 7, 8:17 pm, Dianne Hackborn <[email protected]> wrote:
> Use the fragment support library mentioned by Xav in a recent blog post.
>
> Task == Application.  Each has its own stack.  Just look at how application
> switching works.  That is tasks.  Saying "stack overflow exception" doesn't
> make sense here, you will never get such an exception.  You may run out of
> memory due to too many running activities, and your users may hate you for
> letting them get deep down into different tasks that they have to press back
> on to go where they want and don't understand how navigation through your
> app works.

I don't understand something.  I am using FLAG_ACTIVITY_NEW_TASK and
FLAG_ACTIVITY_RESET_TASK_IF_NEEDED to 'switch' tasks within my
application.  I believe this flags bring the recently running Task to
the front.  I have a button-bar on every screen to switch between the
Tasks (and the Menus also switch tasks too).  This works well because
each Task within the app has its own Activity stack, and I can
navigate into detail for each portion of the app, and still switch to
other portions of the app (Tasks) at will.  I am therefore not adding
Activities at an arbitrary level.  Each Task in my app can go 3-levels
deep maximum (most only allow drilling down to one level).  When I
switch from Task to Task using these flags, Android takes me back to
the Task where the user left off in the Activity stack.  It works
nicely.

When I say I'll run out of memory, this is what I mean:  If the user
switches back-and-forth from Task to Task (the user hits different
icons on the custom button-bar which I drop onto every Activity
screen), they can _still_ hit the back button to go back to the
previous Task *even though* I am not starting any new Activities.  A
Task, once it has started for the first time, just resumes where it
left off because of the Intent flags I use.  It is this 'back history'
that my original question talked about.  If the user switches back/
forth between two 'tab' Tasks in my app (my custom button-bar), and
they do this dozens of times, the 'back' button seems to take them
back across their Task-switching history despite the fact I only have
two Activities on the screen (the root Activity of the two Tasks).
Therefore, it seems to me there is a separate 'back' history when it
comes to switching between Tasks (and the Task documentation does
indicate that when you hit the back-button in the root of a Task, it
goes back to the previous Task.

Therefore, quite simply, is my understanding of how
FLAG_ACTIVITY_NEW_TASK + FLAG_ACTIVITY_RESET_TASK_IF_NEEDED used
together wrong?  The documentation make me believe these flags will
only switch Tasks, bringing the newly requested Task to the
foreground, *without* starting a new Activity.  I am trying to
understand how this "Task switching" fits into the 'back button'
history, and how repeating switching might cause Task switch history
overflow.

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