Back to Top

How to exit from Android application when press Back button?

To exit from Android application on Back button

Here is the quick article about to explain how to exit from the android application when user press back button.

Well, you guys know that most Android applications do not provide an “Exit” or “Quit” button.Back Button in android devices manages history of the previous page. It’s a way to get back to the previous page but sometimes in the big app, it create issue especially when maintain value using session.

So, Here is the easiest way to convert back button to exit from the app.Let’s see the function:

The simple one core function is used to exit from android from an app and it will close an app.

Must Read:

Save Image/File into sd card in Android using PhoneGap
To setup SQLite for Android-Phonegap application
Display Text Format Proper in IPHONE+ANDROID

As always, thanks for reading. Don’t Forget to Follow us on Twitter or Subscribe us to Get the Latest Updates.

Comments (2)

  1. Suraj Sharma says:

    Nice example! Saved my day, thanks!

  2. following codes are working great

    function onDeviceReady() {
    document.addEventListener(“backbutton”, onBackKeyDown, false);
    }
    function onBackKeyDown() {
    navigator.app.exitApp();
    }

Leave a Reply

Your email address will not be published. Required fields are marked *

Most Popular Posts

Function handling Functions in PHP

Posted on 6 years ago

Bhumi

Session_start( ) :: At the top of the page

Posted on 5 years ago

Bhumi

What Are WordPress Nonces?

Posted on 2 years ago

Bhumi

The Reader’s Poll – June 2015

Posted on 2 years ago

Bhumi

The Reader’s Poll – August 2014

Posted on 3 years ago

Bhumi

The Reader’s Poll – June 2014

Posted on 3 years ago

Bhumi

The Readers’ Poll – May 2014

Posted on 4 years ago

Bhumi

The Readers’ Poll – August 2013

Posted on 4 years ago

Bhumi