How to convert a Bitmap to Drawable in android?


Question

How can I convert a Bitmap image to Drawable ?

1
422
10/17/2018 3:37:43 PM

Accepted Answer

Sounds like you want to use BitmapDrawable

From the documentation:

A Drawable that wraps a bitmap and can be tiled, stretched, or aligned. You can create a BitmapDrawable from a file path, an input stream, through XML inflation, or from a Bitmap object.

256
7/18/2016 12:19:16 PM

Try this it converts a Bitmap type image to Drawable

Drawable d = new BitmapDrawable(getResources(), bitmap);

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon