In order to set the wallpaper from within an Android app, you'll have to create an instance of the WallpaperManager class and set the resource from within a try catch block. See the example below:
public void onClick(View arg0) {
WallpaperManager mywall = WallpaperManager.getInstance(getApplicationContext());
try {
mywall.setResource(R.drawable.nameOfFile);
} catch(Exception e) {
e.printStackTrace();
}
}
Click here to download my WWII photo app for iPhone
No comments:
Post a Comment