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

后端 未结 7 1411
失恋的感觉
失恋的感觉 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:30

    As a quick fix you can use the folowing to kill your app:

    android.os.Process.killProcess(android.os.Process.myPid());
    

    But I would not recommend this for commercial apps because it goes against how the Android memory management system works.

提交回复
热议问题