Last active
December 24, 2015 12:08
-
-
Save alvareztech/6795219 to your computer and use it in GitHub Desktop.
Android: Detect physical buttons, back pressed, menu pressed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public boolean onKeyDown(int keyCode, KeyEvent event) { | |
if (keyCode == KeyEvent.KEYCODE_MENU) { | |
// MENU pressed | |
return true; | |
} | |
return super.onKeyDown(keyCode, event); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void onBackPressed() { | |
// super.onBackPressed(); // quit immediately | |
openQuitDialog(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment