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