Android Tech

The more we share, the more we get

Category Archives: Android advanced

Kill process of application when exit

When you want to exit an application by press key BACK on menu, you can return the previous screen may be HOME screen or something else (previous screen of running application) but, unfortunately, if you back to HOME screen and think that your application will kill itself automatically, it’s seriously mistake. You have to add process for this action, kill application itself when user press BACK button until out of your app.

To do this, we will use function name “killProcess” as follow:


We will insert this code in Destroy event when your application have to go through at exit

protected void onDestroy() {
// TODO Auto-generated method stub

try {
}catch (Exception e) {
Log.e(“GoogleMapDemo”, “Exception”, e);


If you are using real device, you can check the process with some software like Taskiller example.