how to disable home button in android?

i want to disable android device home button when my app runs.

i have tried following code but it din’t help :

@Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if ((keyCode == KeyEvent.KEYCODE_HOME)) {
            Toast.makeText(this, "You pressed the home button!",
                    Toast.LENGTH_LONG).show();
            return false;
        }
        return super.onKeyDown(keyCode, event);
    }

     @Override
     protected void onNewIntent(Intent intent) {
     super.onNewIntent(intent);
     if (Intent.ACTION_MAIN.equals(intent.getAction())) {
     Log.i("MyLauncher", "onNewIntent: HOME Key");

     }
     }

  • 2

    Simply say, you can’t !!!

    – 

  • Yes! agreed with @ManishAndroid.

    – 

  • possible duplicate of Disable Home button in Android 4.0 or above

    – 

  • possible duplicate of stackoverflow.com/questions/2162182/…

    – 

  • 1

    you can : stackoverflow.com/a/10810075/1168654

    – 

Leave a Comment