I created a custom dialog on my android app. This dialog is an activity with Dialog theme. Now, assume that the app is showing this dialog, User press "Home" to back to Android Home view. Later, user press and hold button Home
then choose my app from recent apps. It's will show the dialog again.
What I want to do here is that the dialog shouldn't show. I want to show the activity which called this dialog.
How can I do this?
Tap the Recents key (3 vertical bars at the screen bottom). Swipe up on an app to remove it, or tap “Close All” to remove all apps.
Swipe down, settings, Advanced, double press home key, select the option for recent apps. So when you want to clear all the recently used apps, double press the home key, and then close all. Swipe down, settings, Advanced, double press home key, select the option for recent apps.
How to remove activity from recent apps?
I think android:excludeFromRecents="true"
should do the trick. Use it in your manifest
What I want to do here is that the dialog shouldn't show.
dialog.cancel()
in onPause()
Also you can use flag Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS:
.....
i.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
startActivity(i);
The activity you start won't be in recent apps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With