1

I have an activity where a user can change the apps color accent. The choosen color is saved inside SharedPreferences.

Instead of having a static value inside the apps colors.xml file I would like to be able to change that by whatever is saved in the apps SharedPreferences.

<color name="colorAccent">#value_from_shared_preferences</color>

I know there are other different ways to use a user specified color as the apps accent color, but I would like to know how to switch out the value inside the apps colors.xml file.

Update: All resource values are constant so it's not possible to change values inside xml file at runtime.

Ref: Programmatically change the value of a color resource obtained from API response

Community
  • 1
  • 1
Robin
  • 446
  • 2
  • 4
  • 24
  • You can't change the value once your project has been compiled. http://stackoverflow.com/a/33992017/1269953 – Pztar Jan 10 '17 at 19:04

0 Answers0