0

I have 2 apps let's say A and B. App A has activity x and app B has activity 1,2. In app B activity 1 is launcher activity with no flags and activity 2 is singleTask also Activity 1 starts activity 2(for result) with no flags. In app A there is a button in activity x which starts app B's activity 1 with new_task_flag.

My question is when I tap on button then I have 2 tasks i.e x and 1->2, on pressing hardware home button and launching app B then what will be the behaviour of these task. From my understanding task 1->2 should come in foreground but I see multiple instances of activity 2 stacked on task. What am I missing here ?

I have gone through several stackoverflow posts like Android task and process, SingleTask and SingleInstance (David's elaborate answer) and google docs but unable to figure out problem here.

Community
  • 1
  • 1
Daniel
  • 1
  • A few problems: #1 Activity1 cannot start Activity2 (for result) if Activity2 is `singleTask`. You can only get a result back from an Activity that runs in the same task as the Activity that started it. #2 if you haven't specified a different `taskAffinity` for Activity2, it **will not** run in a separate task even if you specify `launchMode="singleTask"`. – David Wasser Jun 15 '15 at 13:20
  • Also, why do you have Activity2 as `singleTask`? – David Wasser Jun 15 '15 at 13:22

0 Answers0