0

I am working on chat. I want to set all emoji icon on text view with text. I have tried by many way but either I am able to set text or a single emojiicon on text. How to set multiple emoji icon with text on text? I have search lots of on google but I did not find anything with working mode.

String text = "hello";                                
for (int i = 0; i < emojilist.length-1; i++) {
    Spanned cs = Html.fromHtml("<img src ='"+ emojilist[i] +"'/>",
        imageGetter, null); 
    textviewobject.setText(cs);
}
stealthjong
  • 10,858
  • 13
  • 45
  • 84
droid5432
  • 21
  • 1
  • 1
  • 8

1 Answers1

1

Try:

String html="";
for (int i = 0; i < emojilist.length-1; i++) { 
     html += "<img src ='"+ emojilist[i] +"'/>";
}

Spanned cs = Html.fromHtml(html, imageGetter, null); 
textviewobject.setText(cs);

And if you want to use SpannableString try: SpannableString with Image example

Community
  • 1
  • 1
vipul mittal
  • 17,343
  • 3
  • 41
  • 44