I have a problem in disabling menu button , I dont want the menu button to be enable , I disable is by returning false
in onPrepareOptionsMenu
func
Hardware menu button is not controlled by onPrepareOptionsMenu().
Generally speaking, it is not good practice to change the behavior of hardware buttons because users expect it to behave a certain way (which I believe is to expand the overflow menu).
If you absolutely have to disable it, you could listen for it to be pressed in our Activities like this:
public boolean dispatchKeyEvent(KeyEvent event) {
final int keycode = event.getKeyCode();
final int action = event.getAction();
if (keycode == KeyEvent.KEYCODE_MENU && action == KeyEvent.ACTION_UP) {
return true; // consume the key press
}
return super.dispatchKeyEvent(event);
}