2

I currently have an Android application when in the process of browsing a hierarchy of objects creates a back stack like this.

BrowseActivity(Starting Instance) -> BrowseActivity(Instance B) -> BrowseActivity(Instance C) -> ViewObjectActivity

There is a menu button in the view object activity that I would like to have take the user back to BrowseActivity(Starting Instance) and destroy the rest of the browse activities.

Using Intent.FLAG_ACTIVITY_CLEAR_TOP only destroys the ViewObjectActivity and leaves the rest in the back stack.

Setting the BrowseActivity to "singleTop" in the manifest breaks the ability to create another instance for further navigation.

Any way to accomplish this that I am probably overlooking?

1

2 Answers 2

1

If you want the menu option to take the user back to the first activity, do just that - take the user back to the first activity.

Have your third activity exit with a specific result that tells the second activity to exit as well. You can extend this to how many activities you want - as long as all the activities except the first one exit, you're good.

Sign up to request clarification or add additional context in comments.

Comments

0

You need to use this flag in a pair. The following has always worked for me

 Intent.FLAG_ACTIVITY_CLEAR_TOP Intent.FLAG_ACTIVITY_NEW_TASK 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.