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?
public class MyActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle extra) {
super.onCreate(extra);
setContentView(R.layout.page_fragment);
}
}
layout/page_fragment.xml:
<?xml version="1.0" encoding="utf-8"?>
<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" />