I want to display the emojis which are in json
object in android.
Right now I am getting some square shapes on textview
.
Asked
Active
Viewed 1,690 times
3

Akshay Katariya
- 1,464
- 9
- 20

Pooja Pachchigar
- 111
- 2
- 12
-
post your json for more better understanding – Akshay Katariya Mar 27 '18 at 12:07
-
I have added a picture in which there are emojis.. I want to display them in android textview.. @Akshay Katariya – Pooja Pachchigar Mar 27 '18 at 12:14
-
are you testing in which device ? Android version? – iamkdblue Mar 27 '18 at 12:17
-
Android Version 6 (Marshmallow) – Pooja Pachchigar Mar 27 '18 at 12:18
-
what you are getting in string ? when you receive from server? can you post that ? i am not talking about above image – iamkdblue Mar 27 '18 at 12:39
-
U want to see the url ??\ – Pooja Pachchigar Mar 27 '18 at 12:40
-
No ! , i want see actual response received at android side ! Can you do debug? – iamkdblue Mar 27 '18 at 12:45
-
try this: https://stackoverflow.com/a/28273410/6925888 – iamkdblue Mar 27 '18 at 13:16
1 Answers
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

Sunil Sunny
- 3,949
- 4
- 23
- 53
-
-
and also want to play the mp4 file which also contains emojis in VideoView – Pooja Pachchigar Mar 27 '18 at 12:11
-
I am also talking about android TextView. So your question is how to extract the string from url ? – Sunil Sunny Mar 27 '18 at 12:12
-
No, I am getting the string but instead of getting the url i am getting some square shapes in place of emojis – Pooja Pachchigar Mar 27 '18 at 12:13
-
Ok the URL is a different question , for displaying title in textview you can use EmojiCompat. – Sunil Sunny Mar 27 '18 at 12:13
-
When are you seeing this squares?. When you set this title in textview right ? – Sunil Sunny Mar 27 '18 at 12:16
-
-
-
I did changed my textview to android.support.text.emoji.widget.EmojiTextView but after that the app is crashing – Pooja Pachchigar Mar 27 '18 at 12:36
-
-
Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/167688/discussion-between-pooja-pachchigar-and-sunil-sunny). – Pooja Pachchigar Mar 28 '18 at 04:30