<resources> <color name="red">#e51c23</color> <color name="pink">#e91e63</color> <color name="purple">#9c27b0</color> <color name="deep_purple">#673ab7</color> <string-array name="colors_hex_code"> <item>@color/red</item> <item>@color/pink</item> <item>@color/purple</item> <item>@color/deep_purple</item> </string-array> </resources> Hello, I declared colors.xml like about code and when I access this value form java like
String[] s = getResources().getStringArray(R.array.colors_hex_code); Toast.makeText(getActivity(), "First Color: " + s[0], Toast.LENGTH_SHORT).show(); , why s[index] always return null? I would like to get hex color codes from "colors_hex_code" string array. Is it possible to access like this? Please help. Thank u.