3

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.

user401183
  • 2,530
  • 4
  • 27
  • 25

1 Answers1

2

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.

George Freeman
  • 2,260
  • 1
  • 15
  • 22
  • This page is now the top Google result for ""second" (resource) cube wallpaper SDK example" - I know it is 5 years later, but if you could recall any specifics for the link / technique you are referencing, I would be very grateful! – AKA May 18 '16 at 22:07