-1

i want to disable navigation bar in my app.i have use below code for it.it disable back button.now i want to disable home button when click on toggle button.how to disable home button using toggle button

@Override
    public boolean onKeyDown(int keyCode, KeyEvent event) 
    {
        if (keyCode == KeyEvent.KEYCODE_BACK ) {
            //preventing default implementation previous to 
            //android.os.Build.VERSION_CODES.ECLAIR
            return false;
        }     
        return super.onKeyDown(keyCode, event);    
    }
Yash
  • 49
  • 1
  • 2
  • 8
  • 1
    I don't think the home button can be disabled, see http://stackoverflow.com/questions/17183905/how-to-disable-home-button-in-android/17183967#17183967. – Bart Aug 27 '15 at 09:20

1 Answers1

0

You can't disable the home button.

But there is a workaround: Start your app again as soon as another app is launched. See http://www.andreas-schrade.de/2015/02/16/android-tutorial-how-to-create-a-kiosk-mode-in-android/

F43nd1r
  • 7,690
  • 3
  • 24
  • 62