How can I save color values inside array.xml and retrieve its back to my code as Color [] array?
Thanks beforehand!
colors.xml
<resources>
<string-array name="colors">
<item>#ff0000</item>
<item>#00ff00</item>
<item>#0000ff</item>
</string-array>
</resources>
Code in activity class.
String[] allColors = context.getResources().getStringArray(R.array.colors);
Color.parseColor(allColors[0]) // red
Color.parseColor(allColors[1]) // green
Color.parseColor(allColors[2]) // blue
<color name="gblue">#4285F4</color>
<color name="ggreen">#34A853</color>
<color name="gyellow">#FBBC05</color>
<color name="gred">#EA4335</color>
<array name="google_colors">
<item>@color/gblue</item>
<item>@color/ggreen</item>
<item>@color/gyellow</item>
<item>@color/gred</item>
</array>
Use this in java/kotlin or style do not use in xml