Android examples for User Interface:Key Event
get Server Keycode
//package com.book2s; import android.view.KeyEvent; public class Main { public static int getServerKeycode(int i) { if (i > 0x20 && i < 0x61) { return i; }// w w w .ja v a 2 s .c o m if (i > 0x60 && i < 0x7b) { return i - 32; } switch (i) { case KeyEvent.KEYCODE_DPAD_LEFT: return 0x25; case KeyEvent.KEYCODE_DPAD_UP: return 0x26; case KeyEvent.KEYCODE_DPAD_RIGHT: return 0x27; case KeyEvent.KEYCODE_DPAD_DOWN: return 0x28; case 0x20: //space return 0x20; } throw new AssertionError("No keycode for key: " + i); } }