简体   繁体   中英

Print Unicode Character 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 the Unicode of "GRINNING FACE WITH SMILING EYES" = 😁

My question here is how can i set this unicode character in textview.

I cannot create a char from this value as it will require only four hexadecimal values.

For example i created a char like this

char c = '\u27A1';

This c works great if i append that to textview and shows me the image properly. How can i create a char of Unicode value U+1F601 - Bytes UTF-8 \\xF0\\x9F\\x98\\x81

Also there are certain unicode characters with double values like this U+1F1F7 U+1F1FA = Bytes UTF-8 \\xF0\\x9F\\x87\\xB7\\xF0\\x9F\\x87\\xBA

How can i display them all in textview ?

UTF-8 \\xF0\\x9F\\x87\\xB7\\xF0\\x9F\\x87\\xBA it is a UTF8 Format you have to make it in UTF16 format for these charectr.

Simply print the UTF16 format String c="\?\?";

now show the c string in text view.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM