how to customize navigate stack on android

200 Views Asked by At

I have a situation like this

I'm using a single activity but with different parameters so I assume that they are seperate activities

This is a navigation sequence

A-B-C-D-E-F, and in F I have a view that takes me to the C, or sometimes B. What I want is when I press back button, the activity must take me to my stack rather than system stack, or when I navigate back to an earlier stack it should pop activities rather than pushing them. How can I do that?

Note: I'm using a single Activity so I need to use the standart launch mode. What I need is to be able to remove Activity instances from stack to the place I navigate

2

There are 2 best solutions below

3
On BEST ANSWER

Use Intent flags and launch mode - look at this free app to help you work out easily what different flags and modes do: https://market.android.com/details?id=com.novoda.demos.activitylaunchmode

See this page for more help : http://developer.android.com/guide/topics/fundamentals/tasks-and-back-stack.html

0
On

You should use INTENT_FLAGS or LAUNCH_MODE to manage your task stack. Also you can use ActivityGroup class and manually manage activities into this group by your parameters and other conditions.