I have 2 activity (Activity A and Activity B)
Activity A is singleTask and Activity B has standard launch mode.
When application started with Activity A and launch mode is singleTask, now from activity A start new activity B on button click.
So Stack is Activity A, B
Now wanted to reorder Activity A which is single task from Activity B but it's finishing Activity B first and then create new Activity A.
So stack at the momemnt is only Activity A.
What I've tried from Activity B.
val intent = Intent(this, ActivityA::class.java)
intent.flags = Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
startActivity(intent)
Problem: Without finishing Activity B required to reorder Activity A with launch mode singleTask.
Appreciated in advance.
You cannot reorder an
ActivitywithsingleTasklaunch mode to the front of the stack. AnActivitywithsingleTasklaunch mode is by definition the rootActivityin a task.Why would you want to do this? If you've configured the
ActivityassingleTask, you have told Android that you want thisActivityto be launched as the root of a task. Why would you want to reorder thisActivityto the front of the task? If theActivitycan exist in the task somewhere other than the root, you shouldn't define it assingleTask!