title: PreferenceActivity: save value as integer
body: <p>Using a simple <code>EditTextPreference</code> in my preferences activity:</p>
  
  <pre><code>&lt;EditTextPreference
      android:key="SomeKey"
      android:title="@string/some_title"
      android:summary="..."
      android:numeric="integer"
      android:maxLength="2"
  /&gt;
  </code></pre>
  
  <p>Is there a way that this configuration value would be saved as integer? Seems now it just allows to enter numbers, but the value is still saved as string:</p>
  
  <p>Calling:</p>
  
  <pre><code>SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
  int value = preferences.getInt("SomeKey", -1);
  </code></pre>
  
  <p>throws me <code>java.lang.ClassCastException: java.lang.String</code>, and:</p>
  
  <pre><code>SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
  String value = preferences.getString("SomeKey", "-1");
  </code></pre>
  
  <p>retrieves the value successfully.</p>
  
  <p>How to make <code>PreferenceActivity</code> to save value as integer by default?</p>