Adilmo
Adilmo

Reputation: 117

launch an activity in different task

I would like to launch an activity (say abc) in a different task every time I launch the activity with flag_new_task.

How do i set a different affinity to the activity each time I launch it.

thanks,

Upvotes: 3

Views: 4420

Answers (1)

David Wasser
David Wasser

Reputation: 95578

If you set both the flags Intent.FLAG_ACTIVITY_MULTIPLE_TASK and Intent.FLAG_ACTIVITY_NEW_TASK when launching the activity, then Android will create a new task every time you do it.

BIG WARNING

HOWEVER, if you create many tasks like this using the same activity, there is no way for the user to return to a specific task by long-pressing on the HOME button. You need to make sure that you don't confuse the user when you do this.

See

http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_MULTIPLE_TASK

Upvotes: 4

Related Questions