Android - Reading arrays.xml
<p>I have a set of preferences stored in arrays.xml, which looks similar to this:</p>

<pre><code>&lt;string-array name="firstname"&gt;
        &lt;item name="1"&gt;Bob&lt;/item&gt;
        &lt;item name="6"&gt;Kevin&lt;/item&gt;
        &lt;item name="3"&gt;Peter&lt;/item&gt;
        &lt;item name="4"&gt;Paul&lt;/item&gt;
        &lt;item name="5"&gt;Simon&lt;/item&gt;
        &lt;item name="2"&gt;Matt&lt;/item&gt;        
&lt;/string-array&gt;

&lt;string-array name="FirstnameValues"&gt;
    &lt;item name="1"&gt;1&lt;/item&gt;
    &lt;item name="2"&gt;2&lt;/item&gt;
    &lt;item name="3"&gt;3&lt;/item&gt;
    &lt;item name="4"&gt;4&lt;/item&gt;
    &lt;item name="5"&gt;5&lt;/item&gt;
    &lt;item name="6"&gt;6&lt;/item&gt;
&lt;/string-array&gt;
</code></pre>

<p>These are used to populate ListPreference. The item stored in SharedPreferences is the name of the item; for example, for Kevin the items stored in SharedPreferences would be 6.</p>

<pre><code>prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
String Firstname = prefs.getString("namesList", "");
</code></pre>

<p>So here, <code>Firstname</code> would give me 6, when selecting the SharedPreference key namesList for the selected item Kevin.</p>

<p>All I want to do is read the array.xml, so I can relate the number 6 back to Kevin. I can use <code>getResources().getStringArray(R.array.testArray);</code> but this just returns an array containing "Bob, Kevin, Peter, Paul, Simon, Matt."</p>

<p>It does not include the named value. </p>

<p>Do you have any idea on how I can get the name as well as the item for each?</p>
