My application works as follow:
On start I have some
AppStartActivity which does something, finishes itself and starts
MainActivity if user is logged in or
LoginActivity finishes itself and starts
MainActivity when user log in successfully.
MainActivity I have
SomeActivity from which user can logout. Activity stack for this situation is
MainActivity > SomeActivity. It is correct, back button works well. When user click
LogOut button there is a problem. I need to show
LoginActivity but I don't want to have
SomeActivity on activity stack anymore.
I could resolve this problem if I wouldn't finish
AppStartActivity. I could go back then with flag
FLAG_ACTIVITY_CLEAR_TOP and it would work well. But here is a problem with back button. I don't want user to come back to this activity with back button. I want it to exit app instead.
FLAG_ACTIVITY_CLEAR_TASK would be best, but I need it working in API level 9.
© Stack Overflow or respective owner