简体   繁体   English

关闭活动时从“最近使用的应用程序”中删除应用程序

[英]Remove application from Recent app while closing the activity

I have the requirement to close the activity as soon as it get launched,to achieve this i used finish() method, but it still exists in running application list. 我需要在活动启动后立即关闭它,以达到此目的,我使用了finish()方法,但它仍存在于正在运行的应用程序列表中。

Please suggest me some solution.. 请给我建议一些解决方案..

The activity you're calling the finish() method, is destroyed and all its resources are queued for garbage collection, because a reference to this activity becomes inaccessible. 您正在调用finish()方法的活动被销毁,并且所有资源都已排队等待进行垃圾回收,因为对该活动的引用变得不可访问。 So, all memory that was used by this activity will be freed during next GC cycle. 因此,此活动使用的所有内存将在下一个GC周期中释放。 and by findihing teh activity, you are destroying the actviity not the app.. 通过发现活动,您正在破坏活动而不是应用程序。

Please keep in mind : 请记住 :

Android keeps processes around in case the user wants to restart the app, this makes the startup phase faster. 如果用户想重新启动应用程序,Android会保持进程,这可以加快启动阶段。 The process will not be doing anything and if memory needs to be reclaimed, the process will be killed. 该进程将不执行任何操作,如果需要回收内存,则该进程将被终止。 Don't worry about it :) 不用担心:)

To remove your app from Recent app list : just specify android:excludeFromRecents="true" in the manifest 要从“ Recent app列表中删除您的应用, 只需在清单中指定android:excludeFromRecents="true"

Refer this link for better explanation 请参阅此链接以获得更好的解释

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM