Android Tech

The more we share, the more we get

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.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: