I'm using this code above to show some text which contains emoticons in an EditText
:
EditText et = (EditText) findViewById(R.id.myeditext);
et.setText(StringEscapeUtils.unescapeJava("This is a text with emoji \u263A"));
This shows me the text I wrote and a smiley emoticon or sth.
BUT if I put another value instead of \u263A
, for example \u1F60A
, it doesn't work. It shows sth like the image in this question here:
Unicode character (U+1FXYZ) not outputting correctly when used in code-behind
Does anyone know how to handle this? Thank you.
UPDATE
How can I use the answer given below, or even the answer that is given in the supposed duplicate question, when the string that contains unicodes is random?
This is a pseudo code of what I want to achieve:
for ( eachFbComment as (String) randomString ) {
//randomString example: "This is a text with emoji \u263A, string countinues here with another emoji \u1F60A, and a last emoji here \u263A! "
print (randomString); // Here I want to display the text + emojis instead of unicode characters.
}