0

Having this attrs.xml file:

<resources>
    <attr name="customColorPrimary" format="color" value="#111111"/>
</resources>

It is possible to write with java code a new value for that color?

Can't find how to do it in the official documentation...

NullPointerException
  • 36,107
  • 79
  • 222
  • 382

1 Answers1

1

Short answer: No.

Long answer: All resources you use in your code are compiled as contents of R class. Every single resource (including string, dimen, layout, style, attr and other) is compiled as some variation of public staticfinalint values. That's why you can't modify it during runtime.

Bartek Lipinski
  • 30,698
  • 10
  • 94
  • 132