How to clear all activity stack in Android

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.

In API level 11 or greater, use FLAG_ACTIVITY_CLEAR_TASK and FLAG_ACTIVITY_NEW_TASKflag on Intent to clear all the activity stack.

 Intent i = new Intent(OldActivity.this, NewActivity.class);
// set the new task and clear flags


Popular posts from this blog

Android Sudoku Game Project With Source Code