button click to go to android wallpaper choose

199 Views Asked by At

I'm new in android programming. I want something to know:

I want users to click on a button to launch wallpaper chooser.

What should I do?

2

There are 2 best solutions below

0
On

WallpaperManager is probably what you're looking for: http://developer.android.com/reference/android/app/WallpaperManager.html

5
On

Implement the following code in you button onClickListener()

WallpaperManager myWallpaperManager
 = WallpaperManager.getInstance(context);
try {
 myWallpaperManager.setResource(R.id.imageName);  
} catch (IOException e) {
     e.printStackTrace();
}

This will change the wallpaper to imageName.