Possible Duplicate:
Android: How to kill an application with all its activities?
I am looking for a way to kill an entire application (e.g. shut down the process) in case my app crashes. The reason I want to do this is because a lot of my runtime data is stored in a static class, and so when the app crashes, this class is killed.
I have seen related questions about the Android philosophy (e.g. about not killing an app etc.), but for now I just need to kill my application. How can I do this?
My app has multiple activities and I tried the following. All it does is restore the previous activity.
System.exit(0)
ActivityManager servMng
servMng = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
servMng.killBackgroundProcesses(<my package name>);
android.os.Process.sendSignal(android.os.Process.myPid(),
android.os.Process.SIGNAL_KILL);
android.os.Process.killProcess(android.os.Process.myPid());