0

I'm building an android app and i want to have different color themes picked by the user in the GUI. Something simple like different shades of a color.

How do you handle this? Do you save all needed colors as colors in the android resources and then depending on the color setting set the colors programmatically? Or can you some how read settings straight in the xml:s?

Or (if you can't do it via the xmls) do you store all colors in a class as public static? Which to me appears simpler if you have to change the colors programmatically.

Thoughts on the matter would be much appreciated :)

SverkerSbrg
  • 503
  • 1
  • 9
  • 23

1 Answers1

0

All this can be done with Themes on Android, you fill find more information reading this article: http://developer.android.com/guide/topics/ui/themes.html

Yoann Hercouet
  • 17,894
  • 5
  • 58
  • 85
  • Thank you, i'm reading up on it! But at which step do you enter the user preference? Is this possible to do in xml or do i have to change style somewhere in the code and put a standard one which i use before i've gotten the preferences from the memory? – SverkerSbrg Apr 14 '13 at 14:31
  • You can save the user preferences using the Shared Preferences. Have a look to this other link: http://developer.android.com/reference/android/content/SharedPreferences.html And this example in this question: http://stackoverflow.com/questions/3624280/how-to-use-sharedpreferences-in-android-to-store-fetch-and-edit-values – Yoann Hercouet Apr 14 '13 at 14:45
  • Thank you, really appreciated you pointing me in the right direction, combined with custom xml attributes i should be able to get it running :) – SverkerSbrg Apr 14 '13 at 14:53