Multiple instances of app in recent app list of tablet(android)

1.3k views Asked by At

I have two activities in my app. First activity launchmode is singleInstance and second activity launchmode is singleTask. I am using these launchmodes because i don't want to destroy any of the activity while switching between them. App is working correctly in case of mobile. But in case of tablet multiple instances(one of first and other of second activity) are visible in recent app list of tablet. How can i avoid multiple instances in recent app list of tablet?

1

There are 1 answers

2
David Wasser On BEST ANSWER

Do not use the special launch modes for this purpose. This creates more problems than it solves. Revert to either standard launch mode or singleTop launch mode.

If you just want to switch between the 2 activities without finishing them or creating new ones, simply add Intent.FLAG_ACTIVITY_REORDER_TO_FRONT to the Intent that you use to launch one Activity from the other. This will just rearrange the activities on the stack without creating any new instances.