public void keyReleased(KeyEvent ke) { if (ke.getKeyCode() == KeyEvent.VK_UP) { String up = history.getUp(); if (up != null) messageText.setText(up); } else if (ke.getKeyCode() == KeyEvent.VK_DOWN) { String down = history.getDown(); if (down != null) messageText.setText(down); } }
// Key events public boolean onKey(View v, int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_DOWN) { // Log.v("SDL", "key down: " + keyCode); SDLActivity.onNativeKeyDown(keyCode); return true; } else if (event.getAction() == KeyEvent.ACTION_UP) { // Log.v("SDL", "key up: " + keyCode); SDLActivity.onNativeKeyUp(keyCode); return true; } return false; }
public void keyTyped(KeyEvent ke) { if (ke.getKeyChar() == KeyEvent.VK_ENTER) { sendMessage(); } }