Mostly when we logout from an application, we want to come to the login screen and clears all the stack of the Activites.
So for this requirement, we just need to use FLAG_ACTIVITY_CLEAR_TOP in addFlags() method.
Below is the code
Intent loginIntent = new Intent(this, LoginActivity.class);
loginIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(loginIntent);
0 Comment(s)