Seting a color using color.xml - an string array
<p>Hey I got this xml array:</p>

<pre><code>&lt;resources&gt;
    &lt;string-array name="colors"&gt;        
        &lt;item&gt;BLUE&lt;/item&gt;
        &lt;item&gt;CYAN&lt;/item&gt;  
        &lt;item&gt;DARK_GRAY&lt;/item&gt;
        &lt;item&gt;GRAY&lt;/item&gt;
        &lt;item&gt;GREEN&lt;/item&gt;
        &lt;item&gt;LIGHT_GRAY&lt;/item&gt;
        &lt;item&gt;MAGENTA&lt;/item&gt;
        &lt;item&gt;ORANGE&lt;/item&gt;
        &lt;item&gt;PINK&lt;/item&gt;
        &lt;item&gt;RED&lt;/item&gt;
        &lt;item&gt;YELLOW&lt;/item&gt;
        &lt;item&gt;WHITE&lt;/item&gt; 
    &lt;/string-array&gt;
&lt;/resources&gt;
</code></pre>

<p>I was trying such simple method which obviously can't work:</p>

<pre><code>public int[] getColorsArray(int i) {        
    int[] allColors = MyApplication.getContext().getResources().getIntArray(R.array.colors); //this is probably wrong
    int[] array = new int[i];

    for (int j = 0; j &lt; array.length; j++) {
        array[j] = allColors[j]; //this is wrong
    }       

    return array;
}
</code></pre>

<p>}</p>

<p>Is there a way to use such xml array?</p>
