I am looking to add emojis using a soft keyboard i am experimenting with. I am aware the default keyboard in android allows entering Emojis.
However when i am trying to commit a string with an emoji it shows up a junk character on the edit text.
Is there some thing i am missing? I am doing the following to commit an emoji :
getCurrentInputConnection().commitText(String.valueOf((char)58389),0);
Same is the case with the emoji keyboard here : https://github.com/zeuxisoo/android-emoji-keyboard
I found the solution to this problem. The emojis are 32bit unicode characters. Hence one has to send 2 16bit characters to commitText to commit an emoji. Something like :
getCurrentInputConnection().commitText("\ud83d\ude01", 1)