title: Multi language settings and getting string array item - android
body: <p>I want to make my app settings with multi language support. Value of settings item will be different in each language. I have string array: </p>
  
  <pre><code>&lt;string-array name="syncTemperature"&gt;
          &lt;item&gt;@string/celcius&lt;/item&gt;
          &lt;item&gt;@string/fehrenheit&lt;/item&gt;
  &lt;/string-array&gt;
  </code></pre>
  
  <p>Which is used in:</p>
  
  <pre><code>&lt;ListPreference
                  android:key="prefTempUnit"
                  android:entries="@array/syncTemperature"
                  android:summary="@string/pref_temp_current"
                  android:entryValues="@array/syncTemperature"
                  android:title="@string/pref_temperature" /&gt;
  </code></pre>
  
  <p>and when I will call:</p>
  
  <pre><code>String celcius = sharedPrefs.getString("prefTempUnit", "Celcius")
  </code></pre>
  
  <p>I will get different value everytime.
  My question is how to have one value for all strings under one item.
  For example when I want to check what user choose and make some action after.</p>
  
  <p>Like this:</p>
  
  <pre><code>if(prefTemUnit==celcius){
      setTempUnitToCelc();
  }
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>For now I figured out one option:</p>
  
  <pre><code>    SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
  
      String unit=sharedPrefs.getString("prefTempUnit", "Celcius");
      String[] stringArray =  getResources().getStringArray(R.array.syncTemperature);
  
      if(unit.equals(stringArray[0])){
          //mymethod
      }
  </code></pre>
  
  <p>but I dont know if its the proper one.</p>