I am implementing Drawer Navigation in my Application. On click of each item of drawer menu list i am calling another Activity and this Drawer Navigation is implemented in every activity.
Now i want to clear BackStack while calling an activity on each item click, so if i press back button then there should not be the previous activity from which user jumped to the current activity.
Do like this-
Intent intent = new Intent(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(intent);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With