Search code examples
androidmenusamsung-mobile

disable Samsung touch Menu Button - onKeyDown does not work


How do I disable the hardware buttons from the samsung devices. Beside the home-button which is a normal button, they have touch-sensitive menu and back button. The onKeyDown and onKeyUp are not called. I implemented this in the activity:

public boolean onKeyDown(int keyCode, KeyEvent event) {
    Log.d(this.getClass().getName(), keyCode + "");
    Log.d(this.getClass().getName(), event.KEYCODE_MENU + "");
    if (keyCode == KeyEvent.KEYCODE_MENU) {
        return true;
    }
    return super.onKeyDown(keyCode, event);
}

It works for the volume buttons, but not this touch-buttons.

Thank you


Solution

  • Check this: Upgraded to AppCompat v22.1.0 and now onKeyDown and onKeyUp are not triggered when menu key is pressed. It solved my problem that was exactly like yours, it seems that new version of AppCompat caused onKeyDow method to not be called anymore.

    Also, you may try to update to v23: https://code.google.com/p/android/issues/detail?id=159795#c31 if it's already available. It worked here.