In my app I have activities A, B, C, D and E. First activity is A then opening B and then C and D. Now my back stack is A-B-C-D. Now when I move to E from D I want to finish all the activity in back stack and now E should be the first activity in stack.
In my case
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
or
android:launchMode="singleTask"
didn't work, because I am not reopening an activity which is already opened. I have to close all the activity in backstack while opening a new activity.
Please help me to do this.
Set following flags:
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
Intent.FLAG_ACTIVITY_CLEAR_TASK);
FLAG_ACTIVITY_CLEAR_TASK
is available from api 11 though.
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