Skip to content

Instantly share code, notes, and snippets.

@umarpazir11
Created November 8, 2016 06:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save umarpazir11/4b2df4426d253c0dee1f1fa1793e8297 to your computer and use it in GitHub Desktop.
Save umarpazir11/4b2df4426d253c0dee1f1fa1793e8297 to your computer and use it in GitHub Desktop.
Normally when we launch new activity, it’s previous activities will be kept in a queue like a stack of activities. So if you want to kill all the previous activities, just follow these methods.
Intent i = new Intent(OldActivity.this, NewActivity.class);
// set the new task and clear flags
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK)
startActivity(i);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment