ALL,
As suggested here I need to make a drawable out of my bitmap. But when I tried to use:
Drawable d = new Drawable( my_bmp);
it shows that this constructor is deprecated in favour of:
Drawable(Bitmap bmp, int resourceId)
How else I can make a drawable out of bitmap?
Thank you.
You can use
Drawable d = new BitmapDrawable(getResources(), my_bmp);
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.
BitmapDrawable(Resources res, Bitmap bitmap)
Create drawable from a bitmap, setting initial target density based on the display metrics of the resources.
Also look a the public constructors @
http://developer.android.com/reference/android/graphics/drawable/BitmapDrawable.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With