So I have my Activity, and on pressing a "Quit" button I call Activity.finish(). This effectively closes my application.
The problem: The Dalvik-process of my application is still hanging around as a zombie in background. It seems like this is normal as other applications do the same. Even The hello-world example hangs around in memory..
I could live with this, but unfortunatley this behaviour makes the development of my application a pain. I have a remote service connected to my Activity, and this service won't unload until my Activity unloads (which as said it never does).
Everything is somehow kept alive for no good reason.
How can I really remove my Activity from memory?
I'm looking for something like Activity.finish_and_kill_my_process_please() call or something similar.
The onStop() and onDestroy() methods get called, and Android destroys the activity. A new activity is created in its place.
Tap and hold on the application and swipe it to the right. This should kill the process from running and free up some RAM. If you want to close everything, press the "Clear All" button if its available to you.
android.os.Process.killProcess(android.os.Process.myPid());
public void onDestroy() {
super.onDestroy();
android.os.Process.killProcess(android.os.Process.myPid());
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With