开发者

Android's InputMethodService keyEventCode won't work

开发者 https://www.devze.com 2023-04-02 00:04 出处:网络
I\'m trying to create my keyboard, and now am at the place when the pressed button should send the letter to the application.

I'm trying to create my keyboard, and now am at the place when the pressed button should send the letter to the application.

In the examples I found

InputMethodService.sendDownUpKeyEvents(keyEventCode);

But couldn't really figure out, what should go into keyEven开发者_运维百科tCode?

For example, how do I send a letter "A" ?

edit: Just one more thing, here ( http://developer.android.com/reference/android/view/KeyEvent.html ) I can find only codes for english character. How do I get other unicode characters?

Thanks!


That function takes the constants from the KeyEvent class. To send a, use

sendDownUpKeyEvents(KeyEvent.KEYCODE_A);
0

精彩评论

暂无评论...
验证码 换一张
取 消