title: Android PreferenceFragment No view found for id for fragment
body: <p>So I'm making an android application and I started dealing with preferences, when I simply use a PreferenceActivity, everything works perfectly, however, if I use it with a PreferenceFragment, it crashes right after I click the button that calls intents to SettingsActivity with an error:</p>
  
  <pre><code>FATAL EXCEPTION: main
  java.lang.RuntimeException: Unable to start activity ComponentInfo{*app package*/*app package*.SettingsActivity}: java.lang.IllegalArgumentException: No view found for id 0x7f08003d for fragment SettingsFragment{41cc1a98 #0 id=0x7f08003d}
  </code></pre>
  
  <p>this is SettingsActivity:</p>
  
  <pre><code>public class SettingsActivity extends Activity {
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          //addPreferencesFromResource(R.xml.preference);
          // Display the fragment as the main content.
          getFragmentManager().beginTransaction()
                  .replace(R.id.pager, new SettingsFragment())
                  .commit();
      }
  
  
      public static class SettingsFragment extends PreferenceFragment {
  
          @Override
          public void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
  
              addPreferencesFromResource(R.xml.preference);
  
          }
      }
  }
  </code></pre>
  
  <p>R.id.pager is only a simple viewPager layout:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.v4.view.ViewPager
  android:id="@+id/pager"
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"/&gt;
  </code></pre>
  
  <p>my preference xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  
      &lt;CheckBoxPreference
          android:key="pref_sync"
          android:title="Sync?"
          android:summary="Do u wanna sync?"
          android:defaultValue="true" /&gt;
  
  &lt;/PreferenceScreen&gt;
  </code></pre>
  
  <p>I'm still quite new to android so any help would be awesome!! Thanks!!</p>
  
  <p><strong>EDIT:</strong>
  Problem solved in comments of correct answer</p>