user2136160
user2136160

Reputation: 245

how set current wallpaper as my application background image Android?

I want to get mobile`s current wallpaper and set that image as the background image of the application. I tried this way but its show a run time exception

final WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
final Drawable wallpaperDrawable = wallpaperManager.getDrawable();
layout.setBackground(wallpaperDrawable);

Upvotes: 2

Views: 1764

Answers (1)

user2136160
user2136160

Reputation: 245

 final WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
 final Drawable wallpaperDrawable = wallpaperManager.getFastDrawable();
 getWindow().setBackgroundDrawable(wallpaperDrawable);

Upvotes: 1

Related Questions