I have a set of preferences stored in arrays.xml, which looks similar to this:

```
<string-array name="firstname">
        <item name="1">Bob</item>
        <item name="6">Kevin</item>
        <item name="3">Peter</item>
        <item name="4">Paul</item>
        <item name="5">Simon</item>
        <item name="2">Matt</item>        
</string-array>

<string-array name="FirstnameValues">
    <item name="1">1</item>
    <item name="2">2</item>
    <item name="3">3</item>
    <item name="4">4</item>
    <item name="5">5</item>
    <item name="6">6</item>
</string-array>

```

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.

```
prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
String Firstname = prefs.getString("namesList", "");

```

So here, `Firstname` would give me 6, when selecting the SharedPreference key namesList for the selected item Kevin.

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

It does not include the named value. 

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