I have one set of images in one drawable folder. I have one button to set image as wallpaper on device screen. But when I set this image as wallpaper its either zoom or crop
If you have image URL then use :
WallpaperManager wpm = WallpaperManager.getInstance(context);
InputStream ins = new URL("absolute/path/of/image").openStream();
wpm.setStream(ins);
If you have image URI then use
WallpaperManager wpm = WallpaperManager.getInstance(context);
wpm.setResource(Uri.of.image);
In your manifest file:
and don't forget to place this code in AsyncTask
.