hi, i am new to android programming and want to develop an application similar to vista where the wallpaper changes automatically , so how should i go about it, please could someone guide me on it? thanks
You would need to use the Wallpaper Manager Api : http://developer.android.com/reference/android/app/WallpaperManager.html
Here is a related tutorial : http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/SetWallpaperActivity.html
Basically, you will have to use the WallpaperManager class which provides the neccesarry methods to do so.
Also, don't forget to add the SET_WALLPAPER permission to your AndroidManifest.xml
:
<manifest xlmns:android...>
...
<uses-permission android:name="android.permission.SET_WALLPAPER" />
</manifest>
Edit: take a look of the example that Ravi Vyas gave you... I didn't know about it and it looks pretty useful.
thanks for that, i have created a layout,having three buttons for choosing the wallpapers i want to use for the app , one for setting the time interval and the 3rd one for resetting. so for the choosing wallpaper button how do i make the user select the desired wallpapers? Also for setting the time , i need to take input from the user time interval(in seconds) during which the wallpaper changes . So, how should i go about it?
For the time button i tried the following ,but gives error:
.....
case(R.id.timeButton):
//get user input
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setMessage("Enter the time interval");
//using EditText to get user input
final EditText edit = new EditText(this);
alert.setView(edit);
//set the +ve and -ve buttons for alert
alert.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Timer ti = new Timer().scheduleAtFixedRate(Activity.WALLPAPER_SERVICE, 0, edit.getText()); //ERROR HERE
//what activity should i set here? so that all the wallpapers selected are shown after 3 secs interval
}
});
Hi , Can you guys please provide us with a small sample code that sets as a wallpaper a drawable that we have in res folder , thanks a lot !