Let's say you have a TabActivity with activities A1, A2, A3, and A4.
When you click on the different tabs, no matter how many times you
navigate between them, when you press the back key you leave the
entire tab group, instead of navigating to a previous tab. My problem
is, I am not using an actual TabActivity.

Does anyone know how to specify to Android that I'd like to mimic that
behavior with a group of activities?  The classic solution (that I
know of) would to simply finish() the activity as you navigate away
from it. That clears the stack, so that when you went from A1 and then
to A2, and pressed back, you don't go back to A1.

The problem with using finish() is that I don't want the activity
removed from memory. These activities load data from the network, so
unless the data was cached, it would need to be reloaded on every
navigation which would not be a great user experience.

I was looking at the flags which you can specify how to change this
behavior:  http://developer.android.com/guide/topics/fundamentals.html#acttask
I tried using these:
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
But no matter what, when I go from A1 to A2 and press back, I always
get back to A1.

Can anyone help in trying to clear the navigation stack without using
finish()?
Thanks!

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