Print Unicode Text Android TextView

I am trying to use emoji icons listed here.

http://apps.timwhitlock.info/emoji/tables/unicode#block-6a-missing-emoticons

Each icon has a unicode character with it, like

U + 1F601 is Unicode "LOOKING FACE WITH EYE HEADS" = 😁

My question here is how can I set this Unicode character in a textview.

I cannot create a char from this value, since it only requires four hexadecimal values.

For example, I created a char like this

char c = '\u27A1';

This c works fine if I add this to a textview and show the image correctly. How can I create a char Unicode value U + 1F601 - Bytes UTF-8 \ xF0 \ x9F \ x98 \ x81

There are also some Unicode characters with double values, such as U + 1F1F7 U + 1F1FA = Bytes UTF-8 \ xF0 \ x9F \ x87 \ xB7 \ xF0 \ x9F \ x87 \ xBA

How can I display them all in text mode?

+4
source share
1 answer

UTF-8 \ xF0 \ x9F \ x87 \ xB7 \ xF0 \ x9F \ x87 \ xBA is the UTF8 format you have to do in UTF16 format for these charectr.

Just print the UTF16 format String c = "\ uD83D \ uDE01";

now displays string c in text view.

+5
source

Source: https://habr.com/ru/post/1544103/


All Articles