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() {
      if(instance==null)
       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

ExitNotifier.getInstance().doExit(true);
finish();


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

if(ExitNotifier.getInstance().isExitting())
    finish();


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!!

37 comments:

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

    ReplyDelete
  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

    ReplyDelete
  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.
    http://www.showboxdownloadsapp.com/

    ReplyDelete

  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

    ReplyDelete
  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

    ReplyDelete
  6. 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.
    Lucky Patcher
    0xc0000142

    ReplyDelete
  7. Very Interesting and wonderfull information keep sharing
    Visit Here

    ReplyDelete
  8. GBWhatsapp apk Download Latest Version 2018. Download Latest GB Whatsapp for Use 2 Whatsapp in One Mobile.  GBWhatsApp APK

    ReplyDelete
  9. OK thanks for this post it's quite informative and I have learned new things.
    hotmail signup process
    kissanime alternatives

    ReplyDelete
  10. Use dual account with Gbwhatsapp Apk Latest Application With free of cost.

    ReplyDelete
  11. Watch more than 900 channels using Live NetTv App on your Smart phone devices.

    ReplyDelete
  12. 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 https://whatsopp.net/download-gbwhatsapp-apk-latest-version/

    ReplyDelete
  13. Gbwhatsapp is the best modded app of popular application nowadays. I am very confident to say you will like this app, because its have many features.

    Gbwhatsapp

    ReplyDelete
  14. 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 detailslucky patcher lucky patcher apk download

    ReplyDelete
  15. We all know about the app GBWhatsApp which is the most popular among all mods of whatsapp. It is unofficial also but there is a lot of features in this app that made people crazy. Today with the new technology people want advance technology in modern era that’s why people attracted more with mods of apps then official. As we know that there are many mods of whatsapp available but GBWhatsApp is the best in all of these.for more Updates Visit Our GBWhatsApp APK

    ReplyDelete
  16. We all know about the app GBWhatsApp which is the most popular among all mods of whatsapp. It is unofficial also but there is a lot of features in this app that made people crazy. Today with the new technology people want advance technology in modern era that’s why people attracted more with mods of apps then official. As we know that there are many mods of whatsapp available but GBWhatsApp is the best in all of these.for more Updates Visit Our GBWhatsApp APK

    ReplyDelete
  17. Really, this article is truly one of the best in the history of the article. I am an antique 'Article' collector and sometimes I read some new articles if I find it interesting. And I found this quite interesting and had to go into my collection.
    Very good job!
    agen domino99
    daftar idpro poker
    88dewa
    aktifqq
    armaniqq
    aslibandar
    aslidomino
    bandarkiu
    bandarq168
    bandarqq

    ReplyDelete
  18. AONQQ Situs Judi Poker Domino 99 QQ BandarQ Online Terpercaya Indonesia memberikan pelayanan yang terbaik dan mudah menangnya bersama AONQQ Situs Poker Online

    ReplyDelete
  19. BWINQQ Situs Judi Poker Domino 99 QQ BandarQ Online Terpercaya Indonesia memberikan jackpot terbesar dan memberikan pelayanan yang terbaik mudah menangnya bersama BWINQQ Situs Poker Online

    ReplyDelete
  20. Main judi online. Pasti dong mau yang gampang dan mudah menang di dalam permainan. Hanya Di situs MiyaQQ anda bisa mendapatkan kemenangan di dalam jalan nya. masih gk percaya? coba dulu baru bisa dapatkan hasil nya.


    situs poker Online

    Situs Poker Online Terpercaya

    Situs Poker Online Terbaik

    situs poker online Terpopuler

    AhliCasino

    ReplyDelete
  21. Great, your post is helping me a lot. Thanks for the detailed info on this topic. It’s hard to find nowadays to know about the basics but you did it so much well. I would love to see more about FM Whatsapp APK. Keep sharing and updated. Also share more posts with us. Thank you.

    ReplyDelete
  22. Hey! I just wanna say that you are sharing a quality and useful content with us. This kind of content is difficult to find it and you are sharing FMWhatsApp is very good. Keep up the high work.

    ReplyDelete
  23. เรารวมเกมส์Poker Online พร้อมวิธีการเล่นโป๊กเกอร์ ระดับมืออาชีพและรวมกลุ่มนักเล่นทั่วไทย ไว้ให้คุณพร้อมเติมเครดิตเล่นได้แล้ววันนี้ 24 ชมPoker is the #1 poker game in the world. Play with friends and see who's got the best poker face or come and meet some new buddies

    ReplyDelete
  24. This was very helpful me for the project. Thanks for sharing this with me.

    ReplyDelete
  25. Very nice article on this topic. I would like to see more such awesome articles from you.
    FMWhatsApp

    ReplyDelete
  26. Excellent Content. I enjoy how you present. Continue to impart more information.

    ReplyDelete