Save the wallpaper of an Android device as a picture

I need to write a program that gets the current wallpaper of an android device and save it to the images folder.

The problem is that I cannot find any information on how to convert the Drawable to a JPEG/PNG

This is my code: currentWallpaper = getWallpaper();

How do I convert this Drawable into a JPEG/PNG file?


As previously mentioned here, take a look at This discusses basically rendering your Drawable on a Canvas backed by a bitmap. You can then save the Bitmap to file using Bitmap.compress.

Leave a Reply

Your email address will not be published. Required fields are marked *