How to set wallpaper in ANDROID?

By | February 17, 2011

Following example shows how to set a Bitmap as wallpaper in ANDROID.
After running this code your wallpaper on the ANDROID phone will change.

Make sure that you have an image named ‘my_wallpaper’ in your drawable folder.

And You have to set this permission in the Manifest.

<uses-permission android:name="android.permission.SET_WALLPAPER"/>
Bitmap wallpaper = BitmapFactory.decodeStream(getResources().openRawResource(R.drawable.my_wallpaper));
    	try
    	{
    			getApplicationContext().setWallpaper(wallpaper);
    	} catch (IOException e)
    	{
    			e.printStackTrace();
    	}

Leave a Reply

Your email address will not be published. Required fields are marked *