title: How do I call a specific PreferenceFragment from a PreferenceActivity?
body: <p>I have a PreferenceActivity with several fragments:</p>
  
  <p><strong>R.xml.preferences:</strong> (shortened for better readability): </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;preference-headers xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;header android:fragment="fragments.Fragment1" android:id="@+id/fragment1" [...] /&gt;
      &lt;header android:fragment="fragments.Fragment2" android:id="@+id/fragment2" [...] /&gt;
      [...]
  &lt;/preference-headers&gt;
  </code></pre>
  
  <p><strong>SettingsActivity</strong>:</p>
  
  <pre><code>public class SettingsActivity extends PreferenceActivity {
      @Override
      public void onBuildHeaders(List&lt;Header&gt; target) {
          loadHeadersFromResource(R.xml.preferences, target);
      }
  }
  </code></pre>
  
  <p>This will show a list entry with <code>fragments.Fragment1</code>, <code>fragments.Fragment2</code>, ... if <code>SettingsActivity</code> is started.</p>
  
  <p>But now I want to pass a Bundle such that a specific PreferenceFragment is opened when starting the activity:</p>
  
  <p>so I added this to <strong>SettingsActivity</strong>:</p>
  
  <pre><code>@Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      if (savedInstanceState != null &amp;&amp; savedInstanceState.getBoolean("shortcut")) {
          // directly jump to fragments.Fragment1
      }
  }
  </code></pre>
  
  <p>I tried to load the fragment via <code>getFragmentManager().findFragmentById(R.id.fragment1)</code>, but this returns <code>null</code>. But even if I had the correct instance, I would not know how to invoke it. Also, calling <code>loadHeadersFromResource(R.xml.preferences_fragment1, target);</code> does not work - This will throw a RuntimeException "<em>XML document must start with  tag; foundPreferenceScreen at Binary XML file</em>". I have no ideas left and also a search on SO and Google did not return any relevant results.</p>
  
  <p>So my question is: Is it possible to directly load a PreferenceFragment (e.g. fragments.Fragment1) from the Activitiy's onCreate method? If so, how?</p>