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 noHistory
to true
for that <activity>
tag in AndroidManifest.xml
:
<activity
android:name=".B"
android:noHistory="true">
This same behavior is also possible from code if B
calls 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.