I am working on an Android applic开发者_StackOverflow社区ation. How can I get Phone wallpaper in Android? Please help me. Give me the sample code example.
You need to use WallpaperManager
which, among other things mentioned in the documentation, allows you to get the current wallpaper.
The following snippet will get the current wallpaper (or the system default if no wallpaper is set).
final WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
final Drawable wallpaperDrawable = wallpaperManager.getDrawable();
final WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
final Drawable wallpaperDrawable = wallpaperManager.getDrawable();
From your activity call
this.getWallpaper();
Wallpaper can be get using getDrawable() of Wallpaper class How can I get Phone wallpaper in Android?
精彩评论