0

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?

john
  • 9
  • 6

2 Answers2

1

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

Andrew Flynn
  • 1,501
  • 12
  • 17
0

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.

Rohan Kandwal
  • 9,112
  • 8
  • 74
  • 107
  • thanks, but my app is not a wallpaper app. i want to offer users to change their wallpaper by clicking on an button. i mean when the users click on a button they be led to wallpaers change. – john Dec 15 '13 at 19:20
  • where they will be lead to have a wallpaper change? gallery or some selected images? – Rohan Kandwal Dec 15 '13 at 19:26
  • did you mean that you already have a selected image and want to change the wallpaper when button is clicked? – Rohan Kandwal Dec 15 '13 at 19:32
  • I really grateful for you, but what i mean is I want to create a button in my activity and when users click on it lead them to wallpapers. somthing like a shortcut that lead users to wallpapers, – john Dec 15 '13 at 19:54
  • you want to open default stock wallpapers? see this http://stackoverflow.com/a/10692374/1979347 – Rohan Kandwal Dec 15 '13 at 19:59