Search code examples
androidandroid-activityactivity-stack

how to customize navigate stack on android


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


Solution

  • 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