Reputation: 109
I am developing a tiny app, it might contains several activities, and in MainActivity
, there's a button aims to kill the whole process, here's what I do in the OnCLick
:
android.os.Process.killProcess(android.os.Process.myPid());
MainActivity.this.finish();
I tested it on my phone. It did exit the activity and backed to my home page, but I long pressed the home page to check the current running process on my phone and found that it's still regarded as a running process. If I open it again, it would be just like a restarted one. Does anyone know how to solve this problem, or is it just a bug that an Android phone might have?
Upvotes: 0
Views: 1820
Reputation: 9023
int pid = android.os.Process.myPid();
android.os.Process.killProcess(pid);
System.exit(0);
Upvotes: 1