Android Activity edit

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 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.


Table Of Contents
39 ACRA
48 Activity
64 Menu
112 Loader
119 Xposed
132 Colors
135 Fresco
140 AdMob
147 Button
156 Vk SDK
170 XMPP
176 OpenCV
200 FileIO
203 Moshi
217 Paint
231 AIDL
241 JCodec
243 Okio
255 Looper
  ↑ ↓ to navigate     ↵ to select     Esc to close