I'm trying to find a way to switch between tasks in android.
Let's say I have Activity A, B, C, D.
Activity A and B are in one task(affinity)
While C and D are in another task.
This is the manifest code of C activity which creates a new task.
<activity
android:name=".CActivity"
android:launchMode="singleTask"
android:taskAffinity="com.new" />
A, B created in one task and C, D created in another task. Now, we need to just switch from D to B without creating a new instance of B. Also could able to switch from A to D without creating a new instance of D.
TASK 1: A > B TASK 2: C > D
Edit: These two stacks are from the same app. The reason I'm using two is one is my normal app and another stack is for the video call feature in my app. So that user can do video call & minimize the window and use the normal flow of the app.
I think you should set flag
FLAG_ACTIVITY_REORDER_TO_FRONT
on Activity B and Activity D. If those activities were previously created, they will be brought to front from the activities stack.