How to clear all stacks activity in Android

Clear all previous activity in Android:

If you want to clear all the previous activities in the queue. Please use the below code.

Snippet:

Intent i=new Intent (Current_Activity.this,NextActivity.class);
//set the new task and clear flags
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(i);

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to Top