Below are my codes, I want to use wallpaper manager to set as wallpaper. I\'m using Universal Image Loader, but i dont know how implement wallpaper manager. My setWall() is
You should convert your Drawable
to a Bitmap
and then use the setBitmap()
function of wallpaper manager to set your desired wallpaper
Convert Drawable to Bitmap
private Bitmap getBitmapFromDrawable(Drawable d){
Bitmap bitmap =
((BitmapDrawable) d).getBitmap();
return bitmap;
}
Set as wallpaper
public void setWall() {
WallpaperManager myWallpaperManager =
WallpaperManager.getInstance(getApplicationContext());
try {
myWallpaperManager.setBitmap(getBitmapFromDrawable(R.drawable.app_icon);
} catch (IOException e) {
// TODO Auto-generated catch block e.printStackTrace();
}
}
Hope this helps
Instead of myWallpaperManager.setResource(0);
Why didn't you use the myWallpapaerManager.setResource(R.drawable.yourimage)
Have a look at Wallpapaer Manager example. Hope this helps you lot.