How to convert a Drawable to a Bitmap?


I would like to set a certain Drawable as the device’s wallpaper, but all wallpaper functions accept Bitmaps only. I cannot use WallpaperManager because I’m pre 2.1.

Also, my drawables are downloaded from the web and do not reside in R.drawable.


This converts a BitmapDrawable to a Bitmap.

Drawable d = ImagesArrayList.get(0);  
Bitmap bitmap = ((BitmapDrawable)d).getBitmap();

Answered By – Rob

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published