0

I am having trouble with my activity management. So I have activity A which goes to B and if you press the back button in B I want it to go to A, but there is also a case where B will finish and go to C and if I press the back button on C I want it to leave the app, basically the back stack is empty. What is the correct way to do this?

The only way I can see to do this is like this. When A starts B it calls finish() on A than on B I override the back button to start A, other wise if certain conditions are met call finish() on B and start C. Having to override the back button seems like I am doing something wrong.

Thanks for your help.

EpicOfChaos
  • 822
  • 11
  • 23
  • 1
    this may help : http://stackoverflow.com/questions/3408388/how-to-kill-sub-activities-and-bring-activity-to-top-of-stack – Nibha Jain Feb 23 '12 at 06:56

1 Answers1

0

I ended up solving this problem through the user of the FLAG_ACTIVITY_CLEAR_TOP which was recommended to me by nibha on this post. Another Post and calling finish() in the appropriate places.

Community
  • 1
  • 1
EpicOfChaos
  • 822
  • 11
  • 23