I am implementing android application which is on web service. I’m creating login Activity A then homepage Activity B and so on.
Suppose there are A, B, C, D and E etc. activities. I’m creating a home button in Activity E and by clicking on that Activity E, D and C should finish and home Activity B should resume.
How can I implement that?
A > B > C > D > E > back button in E
Activity > B.
Take a look at the
FLAG_ACTIVITY_CLEAR_TOPflag.In essence it does the following. If the
ActivitythisIntentis directed to is paused in your current back stack then it will resume it and clear the stack above it destroying all the activities in the stack above it.UPDATE: In response to Jason Hanley.
Thanks for mentioning it. The documentation of
FLAG_ACTIVITY_CLEAR_TOPcovers that example. If you don’t wantActivity Bto be recreated but just passed the newIntentthen you should define its launch mode assingleTop.