user401183
user401183

Reputation: 2570

Android: restart or refresh a LiveWallpaper after preference change

Is it posible to restart a wallpaper after a preference is changed?

I'm thinking I can use this to see the event. But I'm not sure how to update the wallpaper afterwards, if the wallpaper is already running.

public void onSharedPreferenceChanged(SharedPreferences prefs) {

}

Basically, I want to have a wallpaper with a preference that changes a bitmap being used in the canvas.

Upvotes: 3

Views: 2079

Answers (1)

George Freeman
George Freeman

Reputation: 2260

Yes, you can do this, and yes, you've got the right idea. :-) Your best place to start is to look at the "second" (resource) cube wallpaper SDK example, which changes its model (cube vs. dodecahedron) in onSharedPreferenceChanged, based on a user preference change.

In that example, they don't mess with the drawing queue--just alter the data that gets used, but I don't see why you couldn't remove callbacks to your runnable and then restart your drawing process, if that better suits your purpose.

Upvotes: 2

Related Questions