Friday, 30 August 2013

Android - Start a new activity with empty history stack

On android if the app starts a new activity without any kind of flags, the old activity will be put in the history stack, which allow the user press on back button or finish the new activity to bring the old activity back.

For some special situations, for example, after the user has log in, the history stack must be empty. The unique situation which allow the user see the login in screen is when the user log out. For this situation, the history stack must be cleaned.

To do so, add the follow flag to the Intent

Intent startNewIntent = new Intent(this, NewActivity.class);

For more information:

No comments:

Post a Comment