I have the following setup for my activities:
A (noHistory) -> B -> C -> D -> E
So when I start activity E
from activity D
I want E
to become the root activity and clear the rest of the back stack.
I followed the solution mentioned in many posts here which is to add the following flags to my Intent:
final Intent explicitIntent = new Intent(this,
E.class);
explicitIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
explicitIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(explicitIntent);
However, Activity E
(which was not running before) does not become the root of the back stack. Instead, just Activity D
is deleted from the back stack, C
and B
are still there if I press the back button.
So is what I want to achieve really impossible in SDK < 11 as described here: Clear the entire history stack and start a new activity on Android ?