title: Android Color Resource
body: <pre><code>&lt;resources&gt;
  
  &lt;color name="red"&gt;#e51c23&lt;/color&gt;
  &lt;color name="pink"&gt;#e91e63&lt;/color&gt;
  &lt;color name="purple"&gt;#9c27b0&lt;/color&gt;
  &lt;color name="deep_purple"&gt;#673ab7&lt;/color&gt;
  
  &lt;string-array name="colors_hex_code"&gt;
      &lt;item&gt;@color/red&lt;/item&gt;
      &lt;item&gt;@color/pink&lt;/item&gt;
      &lt;item&gt;@color/purple&lt;/item&gt;
      &lt;item&gt;@color/deep_purple&lt;/item&gt;
  &lt;/string-array&gt;
  
  &lt;/resources&gt;
  </code></pre>
  
  <p>Hello, I declared colors.xml like about code and when I access this value form java like</p>
  
  <pre><code>String[] s = getResources().getStringArray(R.array.colors_hex_code);
  
  Toast.makeText(getActivity(), "First Color: " + s[0], Toast.LENGTH_SHORT).show();
  </code></pre>
  
  <p>, 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.</p>