Home > DeveloperSection > Forums > How to disabled back button in android
Brad Pitt
Brad Pitt

Total Post:61

Posted on    February-13-2015 12:41 AM

 Android Android 

 1 Reply(s)
 455  View(s)
Rate this:
How to disabled back button in android?

lois waisbrooker
lois waisbrooker

Total Post:70

Posted on    February-13-2015 5:15 AM

Basically android back button has override method or event. You can handle back button action according to your need on this event; Paste the following code in your Activity and Now your back button is disabled.


    public boolean onKeyDown(int keyCode, KeyEvent event) {

         if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {

             if (keyCode == KeyEvent.KEYCODE_BACK) {





// return super.OnKeyDown(KeyCode,event);

// This code will stop your back button work

         return false;


Don't want to miss updates? Please click the below button!

Follow MindStick