Is it possible to set the android wallpaper image programatically? I'd like to create a service that downloads an image from the web and updates the home screen wallpaper periodically.
+1
A:
From this page on the developer site:
public void setStream (InputStream data)
Change the current system wallpaper to a specific byte stream. The give InputStream is copied into persistent storage and will now be used as the wallpaper. Currently it must be either a JPEG or PNG image.
ChrisF
2009-12-26 19:54:39
Note that API first appeared in 2.0; if you want to support older versions, use one of the original APIs on Context:http://developer.android.com/reference/android/content/Context.html#setWallpaper(java.io.InputStream)
hackbod
2009-12-26 20:51:11
A:
hi, i am developing an application that does the same thing - download image from webserver and set it as wallpapers. Can you please share with me your code on how to do it or provide me some guidance as i am very new in android as well as java development. Thank you.
Lynnooi
2010-01-20 02:18:53
+1
A:
OK Here's how to do it:
You need to call getApplicationContext.setWallpaper() and pass it the bitmap. It just works! Yay!
Jonah
2010-04-20 00:12:51
A:
Can you please provide us with a sample code that sets a wallpaper . thanks a lot !
Amine
2010-08-03 18:38:24