Manish Kumar Sharma
Manish Kumar Sharma

Reputation: 13442

What is the difference between android:launchMode and android:documentLaunchMode attribute?

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

Upvotes: 13

Views: 5118

Answers (2)

j__m
j__m

Reputation: 9645

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.

Upvotes: 4

paperhs
paperhs

Reputation: 204

DocumentLaunchMode is control the app task display in the recent task list(the third button in the guide bar). Just like You open a WebSite in Chrome,and you can open many tab about this Site.

Upvotes: 0

Related Questions