Exclude an activity from back-stack history
Let there be Activity
B that can be opened, and can further start more Activities. But, user should not encounter it when navigating back in task activities.
The simplest solution is to set the attribute
true for that
<activity> tag in
<activity android:name=".B" android:noHistory="true">
This same behavior is also possible from code if
finish() before starting the next activity:
finish(); startActivity(new Intent(context, C.class));
Typical usage of
noHistory flag is with “Splash Screen” or Login Activities.