How can I store the int ID of a drawable in an XML TypedArray
<p>My goal is to store all the int IDs of certain drawables in a TypedArray, so that I can access the IDs in sequential order. For instance:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;resources&gt;
    &lt;array
        name="bitmap_ids"&gt;
        &lt;item&gt;@drawable/icon1&lt;/item&gt;
        &lt;item&gt;@drawable/icon2&lt;/item&gt;
        &lt;item&gt;@drawable/icon3&lt;/item&gt;
        &lt;item&gt;@drawable/icon4&lt;/item&gt;
        &lt;item&gt;@drawable/icon5&lt;/item&gt;
   &lt;/array&gt;
&lt;/resources&gt;
</code></pre>

<p>This does not yield the int result that I am looking for so that I can later do something such as:</p>

<pre><code>TypedArray typedArray = mResources.obtainTypedArray(R.array.bitmapIds);
int[][] t = new int[width][height];
int index = 0;
for (int i = 0; i &lt; width; i++)
    for (int j = 0; j &lt; height; j++) {
        t[i][j] = typedArray.getInt(index, -1);
        index++;
    }
</code></pre>

<p>and even later:</p>

<pre><code>return BitmapFactory.decodeResource(mResources, t[x][y]);
</code></pre>

<p>which would be equivalent to:</p>

<pre><code>return BitmapFactory.decodeResource(mResources, R.drawable.icon1);
</code></pre>

<p>Any hint or insight would be greatly appreciated. Thanks in advance.</p>
