Activity launchMode

suggest change

Launch mode defines the behaviour of new or existing activity in the task. There are possible launch modes:

It should be defined in android manifest in <activity/> element as android:launchMode attribute.

<activity
    android:launchMode=["standard" | "singleTop" | "singleTask" | "singleInstance"] />

Standard:

Default value. If this mode set, new activity will always be created for each new intent. So it’s possible to get many activities of same type. New activity will be placed on the top of the task. There is some difference for different android version: if activity is starting from another application, on androids <= 4.4 it will be placed on same task as starter application, but on >= 5.0 new task will be created.

SingleTop:

This mode is almost the same as standard. Many instances of singleTop activity could be created. The difference is, if an instance of activity already exists on the top of the current stack, onNewIntent() will be called instead of creating new instance.

SingleTask:

Activity with this launch mode can have only one instance in the system. New task for activity will be created, if it doesn’t exist. Otherwise, task with activity will be moved to front and onNewIntent will be called.

SingleInstance:

This mode is similar to singleTask. The difference is task that holds an activity with singleInstance could have only this activity and nothing more. When singleInstance activity create another activity, new task will be created to place that activity.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Activity:
* Activity launchMode

Table Of Contents
2 Gradle
5 Intent
17 Service
19 WebView
31 SQLite
35 Glide
37 Dialog
38 ACRA
44 Handler
47 Activity
53 Toast
63 Menu
65 Picasso
70 Volley
71 Widgets
78 Realm
90 Spinner
95 OkHttp
108 TextView
109 ListView
111 Loader
118 Xposed
119 Security
121 ImageView
123 Doze Mode
130 Drawables
131 Colors
134 Fresco
139 AdMob
145 Keyboard
146 Button
150 EditText
155 Vk SDK
163 ExoPlayer
169 XMPP
175 OpenCV
177 Threads
184 ORMLite
186 TabLayout
190 LruCache
192 Zip files
194 Fastlane
199 FileIO
202 Moshi
210 VideoView
216 Paint
218 ProGuard
226 CleverTap
228 ADB shell
229 Ping ICMP
230 AIDL
234 Context
240 JCodec
242 Okio
249 FuseView
254 Looper
261 Fastjson
263 Jackson
267 Smartcard