android finish() method doesn't clear app from memory

后端 未结 7 1419
失恋的感觉
失恋的感觉 2020-11-30 00:17

I have an activity and I call the finish() method and the activity is not cleared from memory.

After calling finish() , I see that the method onDestroy() is executed

7条回答
  •  半阙折子戏
    2020-11-30 00:42

    Once onDestroy() gets called, your activity is doomed. Period.

    That being said, the process (and hence address space) allocated to your application might still be in use by another part of your application -- another activity or service. It's also possible that your process is empty and the OS just hasn't gotten around to reclaiming it yet; it's not instant.

    See the Process Lifecycle document for more information:
    http://developer.android.com/reference/android/app/Activity.html#ProcessLifecycle

    Regardless, if your activity is relaunched, it will have to go through the entire startup sequence again, starting with onCreate(). Do not assume that anything can implicitly be reused.

提交回复
热议问题