konstantinbueschel
11/25/2016 - 3:53 PM

Change the behavior of the hardware menu button when it is present to show/hide the toolbar overflow menu - From http://stackoverflow.com/qu

Change the behavior of the hardware menu button when it is present to show/hide the toolbar overflow menu - From http://stackoverflow.com/questions/27362030/toolbar-overflow-menu-button-always-showing

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    
    if (keyCode == KeyEvent.KEYCODE_MENU) {
        
        if (mToolbar.isOverflowMenuShowing()) {
            
            mToolbar.hideOverflowMenu();
        } 
        else {
            mToolbar.showOverflowMenu();
        }
        
        return true;
    }
    
    return super.onKeyUp(keyCode, event);
}