title: How to get the fragment instance from the FragmentActivity?
body: <p>I set the content view in the FragmentActivity, and the activity will create the fragment instance for me according to the class name specified in the layout file. But how can I get that fragment instance?</p>
  
  <pre><code>public class MyActivity extends FragmentActivity {
  
      @Override
      protected void onCreate(Bundle extra) {
          super.onCreate(extra);
          setContentView(R.layout.page_fragment);
      }
  }
  </code></pre>
  
  <p>layout/page_fragment.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;fragment xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/pageview"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:name="org.xi.android.PageFragment" /&gt;
  </code></pre>