Resume an activity which is present in different task instead of creating new activity on same task

102 Views Asked by At

I have an activity A in a task T1. Now, I call Activity B which gets opened on a new task T2 (because B's launch mode is "singleTask"). Now I want to go from B to A again. In this case I do not want a new instance of activity A in task T2. Instead I want the existing instance of activity A in task T1 to be called.

Code Snippet :

From Activity A (which is present in task T1):

moveTaskToBack(true);
Intent intent = new Intent(this, ActivityB.class); // ActivityB's launch mode is "singleTask"
startActivity(intent);

Now, from Activity B (which is in task T2)

Intent intent = new Intent(this, ActivityA); // ActivityA's launch mode is default one
startActivity(intent);

I want the instance of Activity A from T1 to be opened instead of creating new instance of Activity A in T2.

Any help is welcome!

0

There are 0 best solutions below