Convert Bitmap to Drawable

1 vote · 2 comments

BitmapDrawable bitmapDrawable = (BitmapDrawable)bitmap; Drawable drawable = (Drawable)bitmapDrawable;

Bitmap bitmap = new Bitmap (...); Drawable drawable = new BitmapDrawable(bitmap);

raw ·
copy
· download
BitmapDrawable bitmapDrawable = (BitmapDrawable)bitmap; Drawable drawable = (Drawable)bitmapDrawable; Bitmap bitmap = new Bitmap (...); Drawable drawable = new BitmapDrawable(bitmap);
Add a comment

2 Comments

Ummm...should this even qualify as a snippet?

Reply · May 4, 2011, 9:22 a.m.

deprecated.

use BitmapDrawable(getResources(), bitmap);

Reply · April 9, 2014, 10:16 a.m.