I am developing a simple app that sets wallpapers based on user input.
I am missing code for setting wallpapers.
I have been looking for it in lots of websites in vain.
Can anybody post a sample code that sets as a wallpaper as a drawable that is saved in the res
folder?
If you use Go Launcher EX, you can tap and hold down the middle of the home screen, and you should get a menu bar on the bottom. Choose Wallpaper. From here, choose the icon for Go Multiple Wallpaper. On the next screen, choose one image for each home screen.
Tip: touch and hold the empty space on your home screen and select Wallpaper at the bottom to reach the wallpaper setting screen. Pick the image you want to use as your background. Once your image (portrait or landscape) is selected, you will see a preview of your wallpaper filling up your whole screen.
Works on Android 1.5 and above
public void setWallpaper() {
Context context = this.getBaseContext();
Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), mImageIds[pos]);
context.setWallpaper(mBitmap);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With