android - 关闭 Activity 时从最近使用的应用程序中删除应用程序

标签 android

我需要在 Activity 启动后立即将其关闭,为了实现此目的,我使用了 finish() 方法,但它仍然存在于正在运行的应用程序列表中。

请给我一些解决方案..

最佳答案

您调用 finish() 方法的 Activity 将被销毁,并且其所有资源都将排队等待垃圾回收,因为对此 Activity 的引用变得无法访问。因此,该 Activity 使用的所有内存都将在下一个 GC 周期期间释放。通过查找 Activity ,您正在破坏 Activity 而不是应用程序..

请记住:

Android keeps processes around in case the user wants to restart the app, this makes the startup phase faster. The process will not be doing anything and if memory needs to be reclaimed, the process will be killed. Don't worry about it :)

要从最近的应用列表中删除您的应用:只需在 list 中指定android:excludeFromRecents="true"

Refer this link for better explanation

关于android - 关闭 Activity 时从最近使用的应用程序中删除应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26581685/

相关文章:

android - Ble 扫描回调只被调用几次然后停止

java - Android 中选项卡的程序结构

android - 如何在youtube应用程序或android studio的外部浏览器中打开单个tabhost标签?

android - Imageview 显示源图像中不存在的照片周围的边框

android - 如何创建用于模拟改造的 ResponseBody 实例

java - LibGDX android在屏幕中生成随机位置

android - 使用 OpenGl 绘制三角形,不出现?

android - 来自android webview的onShowFileChooser()只工作一次

Android - 与内容提供者的 Intent 匹配

android - 更改文本上的阴影大小