Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - How to remove activity from recent apps? [duplicate]

Tags:

android

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?

like image 785
Nguyen Minh Binh Avatar asked Jan 25 '13 14:01

Nguyen Minh Binh


People also ask

How do you remove recents from apps?

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.

Can you clean my recent app?

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.


2 Answers

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()

like image 181
Reno Avatar answered Sep 21 '22 17:09

Reno


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.

like image 30
ivan Avatar answered Sep 20 '22 17:09

ivan