Faris
Faris

Reputation: 81

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?

Upvotes: 1

Views: 3343

Answers (2)

Vodyanikov Andrew
Vodyanikov Andrew

Reputation: 399

There are two links: link1 and link2

'!' - keyKode :1, mortification(caps): 1, '#' keyKode :3, mortification(caps): 1, and so on.

Hope it helps.

Upvotes: 0

Shankar Agarwal
Shankar Agarwal

Reputation: 34765

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);
    }

Upvotes: 1

Related Questions