Search code examples
androidmethodsinputkeycodeime

Android Keycodes for Symbols


I need some help developing my new custom built input method. I'm using InputConnection.sendKeyEvent to send new KeyEvents directly to applications. The problem is that I can't seem to find Keycodes for symbols (such as #$%*).

I tried sending KeyEvent.KEYCODE_SHIFT_LEFT before sending KeyEvent.KEYCODE_SEMICOLON to send a colon and it works, but it doesn't seem to work with numbers.

So my question is how do you get access to all the symbol keycodes?


Solution

  • below are the key codes::: LINK

    KEYCODE_POUND for #

    KEYCODE_STAR for *

    and you can get the key number of the event by using event.getNumber() like below.

        @Override
        public boolean onKeyDown(int keyCode, KeyEvent event)  {
    
            Log.d("::"+keyCode,"::"+event.getNumber());
                return super.onKeyDown(keyCode, event);
        }