How to set unicode in textview to show emoji in android?
This sounds like you want to unescape your string that you've got from JSON. If you don't mind adding a library, Apache Commons has a String.unescapeJava function which does what you need. If you don't want to add that library, see this answer.
rahul
Updated on June 04, 2022Comments
-
rahul about 2 years
I am getting some Unicode string(emoji icons) from server in json string format.
My problem is strange and I am trying for last two days to resolve this issue. When I parse json and store all the Unicode string in an
ArrayList<String>
and try to set the text on TextView by getting value from the same ArrayList then it shows Unicode characters as :Ghcghchgc
\ud83d\ude03\ud83d\ude03fyju\ud83d\ude0c6\u20e3
and when the same string I set on textview by passing static value as :
textview.settext("Ghcghchgc\ud83d\ude03\ud83d\ude03fyju\ud83d\ude0c6\u20e3")
then the textview is showing perfect emojis.
I am stuck at this point. Can anybody please help me to resolve this issue or tell me if I am doing something wrong.
-
Hasmukh Kachhatiya over 6 yearsi also use this but when i get respone again from server enojis become
?
symbol. -
Bonatti almost 6 years@Hasmukhkachhatiya That means that your system does not have the proper Glyph for the symbol (i.e. the code point is not known) read the description