0

I'm making a widget for my app, where you have 4 imagebuttons and 1 background. 3 of The imagebuttons + the background get their image from style xmls in drawable folder and are supposed to be changeable.

My question: Is it possible to import SharedPreferences in my widget in onUpdate to set the style for the buttons+ background? If so: how? If not: what could I do instead?

Felix ZY
  • 674
  • 6
  • 14

1 Answers1

0

onUpdate? You mean when the sharedPreferences is updated? As in this: http://developer.android.com/reference/android/content/SharedPreferences.OnSharedPreferenceChangeListener.html

It is possible to change styles at runtime but I'm a bit confused how you would use SharedPreferences for this.

If you want to let the user customize the interface you could define different styles that the user can pick, and when they do, change the style like this:

android dynamically change style at runtime

Community
  • 1
  • 1
Matt Wolfe
  • 8,924
  • 8
  • 60
  • 77
  • Maybe I should have been more clear. This is about a homescreen widget. Not an app widget. I want to load sharedpreferences onupdate and set the style on update. Onupdate in this case equals the onUpdate event in my widget activity. – Felix ZY Feb 25 '12 at 20:39
  • oh ok sorry.. Not familiar with homescreen widgets at all. – Matt Wolfe Feb 25 '12 at 20:41