I am getting photo with my camera(mobile) and then I need that to set it wallpaper but get me crash.
When I use from setWallpaper()
it say me The method setW
Try this way,hope this will help you to solve your problem.
Declare WallpaperManager object at class level :
private WallpaperManager wallpaperManager;
Initialize WallpaperManager object in initialize() :
private void initialize() {
wallpaperManager = WallpaperManager.getInstance(this);
}
Set bitmap to wallpaperManager object.
case R.id.btnSetWall:
try {
if(bmp!=null){
wallpaperManager.setBitmap(bmp);
}else{
// write your bitmap null handle code here.
}
} catch (IOException e) {
Log.e(TAG, "Cannot set image as wallpaper", e);
}
break;
Add this permission to AndroidManifest.xml :