title: Android listpreference - fetching value
body: <p>I have a <code>listpreference</code>. No matter how I copy the code here, it appears wrong, so I just copy the matter of it:</p>
  
  <pre><code>string-array name="listArray"
  items: Mercedes, Audi, Porsche
  
  string-array name="listValues"
  items: car1, car2, car3
  </code></pre>
  
  <p>I have this code in the <code>preferences.xml</code> at the listpreference part:</p>
  
  <pre><code> &lt;ListPreference
            android:title="List Preference"
            android:summary="This preference allows to select an item in a array"
            android:key="listPref"
            android:defaultValue="digiGreen"
            android:entries="@array/listArray"
            android:entryValues="@array/listValues" /&gt;
  </code></pre>
  
  <p>And this is the code I want to fetch the selected item with:</p>
  
  <pre><code>   String listpref = preferences.getString("listPref", "n/a"); 
     Toast.makeText(TutorialPref.this, "Chosen item of ListPref:" + listpref, Toast.LENGTH_LONG).show();
  </code></pre>
  
  <p>Problem is, it returns the values not the items. So if I select Mercedes, the value I got is "car1".</p>
  
  <p>How can I get "Mercedes"? </p>