I'm following the tutorial trying to set the wallpaper using onclick event of a button.
My code for that is,
private OnClickListener startListener = new OnClickListener(){
public void onClick(View v){
setBg();}
public void setBg(){
WallpaperManager myWallpaperManager
= WallpaperManager.getInstance(getApplicationContext());
try {
myWallpaperManager.setResource(R.drawable.shrek);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Also i've set the permission SETWALLPAPER.
But when i click, Nothing happens.
whats the problem here?