简体   繁体   English

终止应用程序并从最近的应用程序列表中删除[Android]

[英]Kill application and remove from recent apps list [Android]

I know this has been answered earlier but I could not find the appropriate solution which fits in my case. 我知道这个问题早已得到解决,但是我找不到适合我情况的适当解决方案。 I have an app with multiple activities in it. 我有一个包含多个活动的应用程序。 On the first Activity, when the user presses the back button, a close confirmation dialog box is opened to ask the user for confirmation. 在第一个活动上,当用户按下“后退”按钮时,将打开一个关闭确认对话框,要求用户进行确认。

When the user presses 'Yes', the application is closed but it is still in the recent apps list. 当用户按“是”时,该应用程序已关闭,但仍在最近的应用程序列表中。

What I want is to remove it from the recent apps list as well but only when the user comes out of the app using this Close dialog. 我想要的是也将其从最近的应用程序列表中删除,但是仅当用户使用此“关闭”对话框离开应用程序时才将其删除。 ie If the user presses the home button or Apps List button, the app should still be listed in the recent apps list. 即,如果用户按下主页按钮或“应用程序列表”按钮,则该应用程序仍应列在最近的应用程序列表中。

I tried using android:excludeFromRecents="true" property for this activity but it excludes the complete app from the recent apps list even if any other Activity is being worked upon. 我尝试为此活动使用android:excludeFromRecents="true"属性,但即使正在处理其他任何活动,它也会从最近的应用程序列表中排除整个应用程序。

In short, I want to remove the app from the recent apps list on a button click. 简而言之,我想通过单击按钮从最近的应用程序列表中删除该应用程序。

如果您想从最近的任务中删除自己的活动,则可以使用finishAndRemoveTask()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android - 从Recent Apps中删除应用程序 - Android - Remove application from Recent Apps 关闭应用程序并从最近的应用程序中删除/ - Close application and remove from recent apps/ 从软键上的最近应用程序中关闭/杀死Android应用程序 - Close/Kill Android application from recent application on soft key press 如何从最近的应用程序列表中删除应用程序? - How to remove application from recent application list? 从“最近使用的应用程序”列表中删除应用程序后,Android服务将重新启动 - Android service gets restarted when application is removed from Recent Apps list Android应用程序未出现在最近的应用程序列表中 - Android application doesn't appear on recent apps list 如何避免我的android应用程序显示在“最近的应用程序”列表中? - How to avoid my android application to be shown in the “recent apps” list? 如何在完成时从最近的应用列表中删除活动? - How to remove activity from recent apps list on finish? 当按下返回键android时,从最近的应用程序中删除应用程序 - Remove app from recent apps when back key pressed android 是否可以通过在 Android 上使用 Appium 滑动来从最近的应用程序屏幕中杀死一个应用程序? - Is it possible to kill an app from recent apps screen by swiping using Appium on Android?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM