How to disabled back button in android

Total Post:61

 1052  View(s)
Rate this:
How to disabled back button in android?
  1. Post:70

    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.

        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



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