KulArtist
KulArtist

Reputation: 962

set phone background image from gallery

I want to open image from galley and then set that image as phone background. I am able to open the gallery but getting error while setting that image as phone background.

Upvotes: 0

Views: 158

Answers (1)

Ziad Halabi
Ziad Halabi

Reputation: 866

Retrieve the image from the imageUri and save it as a bitmap object. Make sure you have the Set Wallpaper permission in the Android Manifest.

Bitmap image =MediaStore.Images.Media.getBitmap(getContentResolver(), imageUri);

WallpaperManager myWallpaperManager = WallpaperManager.getInstance(getApplicationContext());
myWallpaperManager.setBitmap(bitmap);

Upvotes: 1

Related Questions