I try to get the emoji code inside a long string from database, in this format: 0x1F60A ... So I can access the code but it will be a String.
At first, I tried to cast the variable by doing tv.setText(beforeEmo + getEmijoByUnicode((int)emoKind));
but Android Studio hints: "cannot cast 'java.lang.String' to int"...
The getEmijoByUnicode method is:
public String getEmijoByUnicode(int unicode) {
return new String(Character.toChars(unicode));
}
So I tried this one:
tv.setText(beforeEmo + getEmijoByUnicode(Integer.parseInt(emoKind)));
but it crashes with NumberFormatError. Is there any way to make the emoji appear in my text?