Skip to content

Instantly share code, notes, and snippets.

View michael-conrad's full-sized avatar

Michael Conrad michael-conrad

View GitHub Profile
// Key events
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
// Dispatch the different events depending on where they come from
// Some SOURCE_DPAD or SOURCE_GAMEPAD are also SOURCE_KEYBOARD
// So, we try to process them as DPAD or GAMEPAD events first, if that fails we try them as KEYBOARD
if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {
keyCode = KeyEvent.KEYCODE_ENTER;
}