Activity.finish() called but activity stays loaded in memory

女生的网名这么多〃 提交于 2019-11-27 05:05:40

You don't control when your app leaves main memory, the OS does. Look closely at Activity.finish...

Call this when your activity is done and should be closed. The ActivityResult is propagated back to whoever launched you via onActivityResult().

Note that is says nothing about memory. As to calling Activity.onResume, that's exactly what you would expect for the lifecycle; remeber that onResume is not just called after a resume but even when the app is first launched after onCreate.

While not exactly what you asked I suggest you read this article about exit buttons which goes on to say something very important

[Activity.finish] is exactly equivalent to hitting the back button.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!