title: Android Preferences: How to load the default values when the user hasn't used the preferences-screen?
body: <p>I am using a PreferenceActivity to let the user set some values.
  I am feeding it the xml file with the defined preferences.</p>
  
  <p>I have set all the <code>android:defaultValue=""</code> for them.</p>
  
  <p>When I start my application, I need the preferences, or if they are not set yet manually, I want the default values:</p>
  
  <pre><code>SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
  boolean value = prefs.getBoolean("key"), false); 
  </code></pre>
  
  <p>However, when <code>android:defaultValue="true"</code> I still get <code>false</code>. So, it looks like the defaultValues set in the XML are not used anywhere but when initializing the preferences-screen.</p>
  
  <p>I don't want to hardcode the default values in the <code>getBoolean()</code> method. So, is there a way get the default-values with only defining these in 1 place?</p>