Adding an Exit button to Android Application

So what is the right way of closing the application!

Usually it is "USER! press back ! press back! keep pressing back! we are close!! okay finally bye"

Here is a small idea i had on adding an Exit button to application.

In my personal opinion, even android users will find a Close button nice and friendly.

public class ExitNotifier {
     public ExitNotifier getInstance() {
       instance = new ExitNotifier();
      return instance;
     public boolean isExitting() {
      return exit;
     public void doExit(boolean exit) {
      this.exit = exit;
     private static ExitNotifier instance;
     boolean exit;
     private ExitNotifier() {
      exit = false;

Whenever the exit button is pressed, do the following


In all activities, in your onActivityResult function add the following line:


The only requirement for this is to always use startActivityForResult when starting new Activities.
If you want to eliminate this requirement, just add the code you added to the onActivityResult to your onResume of all your activities.

Enjoy! I like it!!


  1. Usually it is "USER! press back ! press back! keep pressing back! we are close!! okay finally bye" Cell Phone Tracker Location

  2. The asset tracking capabilities of a great helpdesk program, should allow for the software to be remotely loaded from the network onto client PCs. This way it should be able to track their operating system, hardware details, and software details. driver toolkit serial

  3. The open source nature of Android has opened extensive portal for mobile app development and shaking hands with OHA (Open handset Alliance), more than 80 companies are changing the world continuously, with rapid advancements in the OS.


  4. If you face any kind of trouble during movies downloading and you want to see latest movies in HD format then you need an app like Showbox.
    Nowadays this app is getting much popular because of its attractive and trendy
    ShowBox for Windows

  5. Apps not only ensure to enhance business productivity, but can also help businesses to publicize their brand to a wider market segment.
    click here