0

How to disable home and back buttons?

Markus Kauppinen
  • 3,025
  • 4
  • 20
  • 30

1 Answers1

0

Home Button:

<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />

To disable Home Button:

    @Override
    public void onAttachedToWindow() {
        // TODO Auto-generated method stub
        this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
        super.onAttachedToWindow();
    }

To disable Back Button:

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
// Do nothing or catch the keys you want to block
  }

To add this in your Android Manifest:

<uses-permission android:name="android.permission.REORDER_TASKS" />
PartTimeNerd
  • 305
  • 1
  • 2
  • 20