List of usage examples for android.view KeyEvent getMatch
public char getMatch(char[] chars)
From source file:Main.java
/** * Get an unaccepted key code.//from ww w . j av a 2s .c o m * * @param acceptedChars accepted chars array. * @return return key code if we find unaccepted one, or return -1. */ public static int getUnacceptedKeyCode(char[] acceptedChars) { for (int keyCode = KeyEvent.KEYCODE_A; keyCode <= KeyEvent.KEYCODE_Z; keyCode++) { KeyEvent event = new KeyEvent(KeyEvent.ACTION_DOWN, keyCode); if ('\0' == event.getMatch(acceptedChars)) { return keyCode; } } return -1; }