Android's Inputmethodservice - How To Get Unicode Characters?
I'm trying to make a keyboard... int code = 29; // Key code constant: 'A' key. Constant Value: 29 (0x0000001d) KeyEvent k = new KeyEvent(KeyEvent.ACTION_UP, code); InputConnection
Solution 1:
If you are building a keyboard app, and have keyboard layout in xml, you can look at suggestion provided by user Laurent' in another thread:
<Keyandroid:codes="946"android:keyLabel="\u03B2"/><Keyandroid:codes="946"android:keyLabel="&946;"/><Keyandroid:codes="946"android:keyLabel="β"/><!-- Warning, you should use UTF-8 encoding for your project files if you use the third solution --><!-- all produce the same key with greek β character (unicode \u03B2, decimal 946) -->
Solution 2:
Please check the softkeyboard sample code.
If you are developing a new keyboard(for example for any other language), change the android:code attribute value to the unicode value which you want the keyboard to output. This works fine and I think you can test it in the same softkeyboard project.
Post a Comment for "Android's Inputmethodservice - How To Get Unicode Characters?"