1

I have seen some examples of external bitmap files being shown in TextView control. In my case, I get the bitmap as binary data from a database. I need to show the bitmap along with some text in TextView control. I am wondering if someone can point me in the right direction. An example would be greatly appreciated.

Thank you in advance for your help.

Zong
  • 6,160
  • 5
  • 32
  • 46
Peter
  • 11,260
  • 14
  • 78
  • 155

1 Answers1

0

Images are displayed in a TextView by incorporating an ImageSpan into the Spannable that is the "text" shown by a TextView.

See SpannableString with Image example for the basic mechanics. In that example, they use a Drawable resource, but there is an ImageSpan constructor that takes a Bitmap, which you could create via a BitmapFactory and obtain from wherever you need to.

Community
  • 1
  • 1
CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491