3

Is it possible to modify the current wallaper via code? I'm getting the current wallpaper trough

WallpaperManager wpm=WallpaperManager.getInstance(myContext);
Drawable draw=wpm.getDrawable();

then I try to desaturate it with

ColorMatrix matrix = new ColorMatrix();
matrix.setSaturation(0);    
ColorMatrixColorFilter filter = new ColorMatrixColorFilter(matrix);
draw.setColorFilter(filter);

then i create the bitmap and i try to set it as wallpaper trough

Bitmap bitmap = ((BitmapDrawable)draw).getBitmap();
try {
      wpm.setBitmap(bitmap);
} catch (IOException e) {
      e.printStackTrace();
}

but it doesn't do anything. I also tried with

myContext.setWallpaper(bitmap);

but it neither works. I already have the permissions to change the wallpaper, so I cannot find my mistake

Va Le
  • 31
  • 1

0 Answers0