0

When setting the wallpaper I'm using an int and then I'm converting it into a bitmap with decodestream but the wallpaper is still not set.

Here is my code

InputStream y = getResources().openRawResource(friendship);
Bitmap b = BitmapFactory.decodeStream(y);

try {               
    getApplicationContext().setWallpaper(b);
    Toast.makeText(this, "Wallpaper Set!", Toast.LENGTH_SHORT).show();
} catch (IOException e) {
    e.printStackTrace();
}
a sandwhich
  • 4,352
  • 12
  • 41
  • 62
9477
  • 3
  • 6
  • `setWallpaper()` is deprecated. Instead use WallpaperManager http://stackoverflow.com/questions/11953359/using-wallpapermanager-in-android-to-set-wallpaper – James Fenn Jul 22 '15 at 16:05

1 Answers1

0

Is the permission SET_WALLPAPER set in the manifest file? Android docs link

Further more, the method that you are using is deprecated. You should be using WallpaperManager apis

prijupaul
  • 2,076
  • 2
  • 15
  • 17