So I have been reading the docs on Tasks, Back Stack and Overview Screen and there is one thing that immensely confuses me. After having read launchMode
here: http://developer.android.com/guide/components/tasks-and-back-stack.html then about documentLaunchMode
here: http://developer.android.com/guide/components/recents.html I can't tell how they differ!
Both have been depicted to provide ways to control launch of new Activity in tasks relative to current task(The task of launching activity). So how these 2 modes are different? What does the appending of -document imply?
Here are the docs which directly refers to their use in the manifest file:
LaunchMode: http://developer.android.com/guide/topics/manifest/activity-element.html#lmode
DocumentLaunchMode: http://developer.android.com/guide/topics/manifest/activity-element.html#dlmode
DocumentLaunchMode:
Possible Values:
launchMode:
Possible Values:
Logical Relationship: For values other than "none" and "never" (documentLaunchMode) the activity must be defined with launchMode="standard". If this attribute is not specified, documentLaunchMode="none" is used.
Let's take a quick look at the launchMode
values:
standard
and singleTop
both allow multiple instances of an activity to be created, within other tasks.
singleTask
and singleInstance
both limit an activity to a single instance, as the first activity in its task.
Anything seem to be missing to you? None of these values allow multiple instances of an activity to be created at the top level. Either you launch instances of your activity into other people's tasks, or you limit it to a single instance. None of these values allow multiple tasks to be created to host your activity. This oversight is what documentLaunchMode
addresses. The idea is that if your activity has an intent filter that allows it to view documents, that each of those documents -- each data uri -- should be able to get its own instance of your activity in its own task.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With