从最近的应用程序编程方式删除应用程序应用程序、最近、方式

由网友(心罪)分享简介:我知道,活动可以在舱单申报为被排除在最近通话与安卓excludeFromRecents :http://developer.android.com/guide/topics/manifest/activity-element.html#excludeI know that Activities can be dec...

我知道,活动可以在舱单申报为被排除在最近通话与安卓excludeFromRecents : http://developer.android.com/guide/topics/manifest/activity-element.html#exclude

I know that Activities can be declared in manifest as being excluded from recents with android:excludeFromRecents: http://developer.android.com/guide/topics/manifest/activity-element.html#exclude

不过,这不是我要找的,我想知道是否有一种方法可以从最近的应用程序的编程

However, that's not what I'm looking for, I would like to know if there is a way to remove the app from recent apps programmatically

推荐答案

是,通常当你想有一个活动的特殊属性启动时,你提供特殊标志到意图。在这种情况下FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS.

Yes, generally when you want to have special properties for an Activity when starting it you supply special flags to the Intent. In this case FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS.

更新:

如果你需要隐藏当前已经运行的活动,你可能能够使用此标志与FLAG_ACTIVITY_CLEAR_TOP组合,将发送新的意图,以现有的活动。你必须去思考,也许尝试什么作为用户你的筹码周围的动作发生,但并不管,这将使您的应用程序重新出现在最近的应用程序。

If you need to hide the current already running activity, you might be able to use this flag in combination with FLAG_ACTIVITY_CLEAR_TOP which would send the new Intent to the existing Activity. You'll have to think and perhaps experiment with what happens as the user moves around your stack though and whether that will make your app re-appear in the recent apps.

阅读全文

相关推荐

最新文章