title: Initialize preferences from XML in the main Activity
body: <p>My problem is that when I start application and user didn't open my <code>PreferenceActivity</code> so when I retrieve them don't get any default values defined in my preference.xml file.</p>
  
  <p>preference.xml file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
      android:key="applicationPreference" android:title="@string/config"
      &gt;
      &lt;ListPreference
              android:key="pref1"
              android:defaultValue="default"
              android:title="Title"
              android:summary="Summary"
              android:entries="@array/entry_names"
              android:entryValues="@array/entry_values"
              android:dialogTitle="@string/dialog_title"
      /&gt;                  
  &lt;/PreferenceScreen&gt;
  </code></pre>
  
  <p>Snippet from my main Activity (<code>onCreate</code> method):</p>
  
  <pre><code>    SharedPreferences appPreferences = PreferenceManager.getDefaultSharedPreferences(this);        
      String pref1 = appPreferences.getString("pref1", null);
  </code></pre>
  
  <p>In result I end up with a <code>null</code> value.</p>