My string.xml
is utf-8.
<string name="id">Hi \u0026</string>
^This worked. and showed as: Hi &.
But this does not work with this emoji 👈:
<string name="id">Hi \u1F448</string>
https://www.compart.com/en/unicode/U+1F448
How can I make it work with 👈?
You can put emojis in an XML, and the squares are just the editor's way to render characters it can't recognize, like all other characters, you can specify the character by its UTF8 value instead. For example, 😃 has the char value of 128515, so you could use 😃 to specify it.
When displaying an emoji, your device looks up the image it should show for the given code point. When it comes across a "code point" it doesn't understand, it shows a symbol to represent an unknown emoji. This symbol is the question mark or box, depending on the device.
Use HTML Entity (decimal) i.e. 👈
to add 👈 in strings.xml
and use it in your app.
So your string will be:
<string name="emoji">Hi 👈</string>
Output:
For more information please check here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With