1

I need to get the path of the image currently serving as a background image in the wallpaper.

I managed to get the bitmap itself (using the drawable from the wallpaper manager) - but i dont need the drawable- i need the path so i can save it in sharedpreferences and use it later.

final WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
final Drawable wallpaperDrawable = wallpaperManager.getDrawable();
final Bitmap wallpaperBitmap =drawableToBitmap(wallpaperDrawable); 

btw, according to The wallpapermanager's manual i cant use getWallpaperInfo since it will return null if its not a live wallpaper.

thanks for any help

Wops
  • 983
  • 9
  • 23

1 Answers1

1

try below code

Drawable wallpaper = peekWallpaper();
final Bitmap wallpaperBitmap =drawableToBitmap(wallpaper);

and for absolute path follow this https://android.stackexchange.com/a/27709

Community
  • 1
  • 1
Sanket Kachhela
  • 10,861
  • 8
  • 50
  • 75