2

We're trying to build a SoftKeyboard for an android app. The characters to be shown on the keyboard are asian language characters.

Any pointers will be helpful.

singhspk
  • 2,389
  • 3
  • 23
  • 28

5 Answers5

3

Actually, it depends on wether the characters you will be using are supported (displayable) in the android system font.

If they are, simply use the unicode codes in your keyboard xml definition, e.g.:

<Key android:codes="946" android:keyLabel="\u03B2"/> 
<Key android:codes="946" android:keyLabel="&946;"/> 
<Key android: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)

If they are not, then your only solution is to use icons: the keyboard character Typeface is hardcoded in android KeyboardView.java source code (method onBufferDraw()) and defaults to Typeface.DEFAULT_BOLD

Laurent'
  • 2,611
  • 1
  • 14
  • 22
0

We ended up using button icons. This seems to be the most straight-forward way.

singhspk
  • 2,389
  • 3
  • 23
  • 28
0

Did you read the tutorial? http://developer.android.com/resources/articles/creating-input-method.html

Cheryl Simon
  • 46,552
  • 15
  • 93
  • 82
  • Yes. We played with the sample too. Right now, we're using icons for the keys. Was wondering if there's another way using unicode to do the same. – singhspk Sep 16 '10 at 18:48
  • Ok, it might help if you made your question more specific to your actual problems. I.e., How do you show asian language unicode characters in a TextView? – Cheryl Simon Sep 16 '10 at 20:42
0

I have no experiance in Android, but much more in Java ME. In case of mobiles, and also in desktops, it is not possible for unicode charactor to render exactly as required as it is the font dependable. The font used for rendering the text must have the said charactor code in it, else a ? or dark rectangle will be displayed. Your best solution seems the image fonts (icons you are currently using).

Ashish Patil
  • 818
  • 7
  • 15
0

I'm also working on a softkeyboard and using hashmap for mapping bangla characters with codes, typeface enabled me to use bangla font for candidate view but no luck with keyboard keys (it needs to inastall font in system by rooting), still suffring from complex font rendering, glyphs are shown as broken characters, currently using SQLite database for prediction, if you know how to use .dict for prediction please let me know :).

Imran Rana
  • 11,899
  • 7
  • 45
  • 51