@Override public boolean onKeyUp(int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0)) { if (OFAndroid.onBackPressed()) return true; else return super.onKeyUp(keyCode, event); } OFAndroid.onKeyUp(keyCode); return super.onKeyUp(keyCode, event); }
/** * @param keyCode * @param event * @return true to say we handled this, false to tell Android to handle it */ public static boolean keyUp(int keyCode, KeyEvent event) { 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(); onKeyUp(unicodeChar); // return false to let Android handle certain keys // like the back and menu keys return false; } }