2

I am using this emoji library

https://github.com/hani-momanii/SuperNova-Emoji

This library has a custom textview which can render emojis. How do I set text of that textview so it displays emojis ?

For example I tried this and it did not work :

String happy = " Feeling happy U+1F601 ";
emojitextview.setText(happy);
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
  • Possible duplicate of [how set emoji by unicode in android textview](http://stackoverflow.com/questions/26893796/how-set-emoji-by-unicode-in-android-textview) – OneCricketeer Nov 10 '16 at 04:50

1 Answers1

3

Switch out the 'U+' for '0x':

int unicode = 0x1F601;

String happy = "Feeling happy " + getEmojiByUnicode(unicode);

And put it through a helper function:

public String getEmojiByUnicode(int unicode){
    return new String(Character.toChars(unicode));
}

p.s. if it still doesn't work, you may have to set the textView to use a typeface that supports emoji characters

from: how set emoji by unicode in android textview

Community
  • 1
  • 1
Sammy T
  • 1,924
  • 1
  • 13
  • 20