First of all, I don't know whether I should ask this here or in the repo, but as I saw other questions for other libraries like.. Picasso, so here goes :
I'm trying to implement Emojione into my Android app. I've downloaded a small static class to convert all short name to unicode from Emojione Github Repo.
The problem is, when I try to use it to convert :smile: to unicode..
Emojione.shortnameToUnicode(postMessageText, true); // postMessageText is ":smile:"
The answer is actually in front of my eyes all the time. It really did convert to unicode but, I might be wrong here, in a font unsupported by Android. So I tried using
SpannableStringBuilder to span the emoji part to use
Here's how :
int firstEq = sb.length(); Typeface font = FontCache.getTypeface("emojione-android.ttf", context); String convertPart = Emojione.shortnameToUnicode(part, true); sb.append(convertPart + " "); int lastEq = sb.length(); sb.setSpan(new CustomTypefaceSpan("", font), firstEq, lastEq, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
And that's how I got the
TextView to show emojis.. Just use the font!