HOW TO DISABLED BACK BUTTON IN ANDROID

Brad Pitt

Total Post:61

Points:429
Posted by  Brad Pitt
 932  View(s)
Ratings:
Rate this:
How to disabled back button in android?
  1. lois waisbrooker

    Post:70

    Points:494
    Re: How to disabled back button in android

    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.

    @Override
        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;
        }

      Modified On Apr-09-2018 01:29:41 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!