in my android app i wrote a below code to clear the stack of the activities, but this code is not working, so i request you to provide me working snippets on this.
Intent intent = new Intent(UserProfile.this, Login.class)
.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
finish();
startActivity(intent);
Thanking you
If current Activity is A and you wants to launch B Activity, also, C and D paused in background, FLAG_ACTIVITY_CLEAR_TOP will finish C and D but not A.
there is a workaround can let you finish A activity. Create a “static” Handler that can do finish() while receive message in A activity, then sendMessage using static Handler from A while B activity started.