/** * @param keyCode * @param event * @return true to say we handled this, false to tell Android to handle it */ public static boolean keyDown(int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0)) { if (onBackPressed()) { return true; } else { // let the Android system handle the back button return false; } } if (KeyEvent.isModifierKey(keyCode)) { /* Android sends a shift keycode (for instance), then the key that goes with the shift. We don't need the first keycode, that info is in event.getMetaState() anyway */ return false; } else { int unicodeChar = event.getUnicodeChar(); onKeyDown(unicodeChar); // return false to let Android handle certain keys // like the back and menu keys return false; } }
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { OFAndroid.onKeyDown(keyCode); return super.onKeyDown(keyCode, event); }