3

I want to display the emojis which are in json object in android. Right now I am getting some square shapes on textview.

enter image description here

Akshay Katariya
  • 1,464
  • 9
  • 20
Pooja Pachchigar
  • 111
  • 2
  • 12

1 Answers1

0

You can't directly set emoji in TextView Either you can use this https://developer.android.com/guide/topics/ui/look-and-feel/emoji-compat.html

add this in gradle

dependencies {
    ...
    compile "com.android.support:support-emoji:27.1.0"
}

Implement this in your application code

  public class MyApplication extends Application {
  @Override
   public void onCreate() {
     super.onCreate();
     FontRequest fontRequest = new FontRequest(
       "com.example.fontprovider",
       "com.example",
       "emoji compat Font Query", CERTIFICATES);
       EmojiCompat.Config config = new FontRequestEmojiCompatConfig(this, fontRequest);
       EmojiCompat.init(config);
   }
}

and change your TextView to android.support.text.emoji.widget.EmojiTextView

You can check this if you have any doubts https://github.com/googlesamples/android-EmojiCompat

or

You can try unicode directly like this

https://stackoverflow.com/a/26894146/3111083

Sunil Sunny
  • 3,949
  • 4
  • 23
  • 53