0

I'm making an app that take datas from a database and it should take an ImageIcon. How can I use that class in Android and convert it to Drawable to show it in app?

It's not from a resource file. It's from an ImageIcon as variable of an object i receive from database.

Andrean
  • 313
  • 1
  • 4
  • 13
  • See this answer - http://stackoverflow.com/questions/16320725/how-do-i-convert-an-imageicon-to-bitmapdrawable-in-android – Zain Nov 30 '15 at 11:24
  • 1
    Possible duplicate of [How to create Drawable from resource](http://stackoverflow.com/questions/4818118/how-to-create-drawable-from-resource) – abbath Nov 30 '15 at 11:32

1 Answers1

0

try this

Bitmap bitmap = BitmapFactory.decodeFile("/path/images/image.png");
Drawable d = new BitmapDrawable(getResources(), bitmap);
Deepak
  • 756
  • 4
  • 10