Tôi đặt chế độ xem nội dung trong FragmentActivity và hoạt động sẽ tạo cá thể phân đoạn cho tôi theo tên lớp được chỉ định trong tệp bố cục. Nhưng làm thế nào tôi có thể có được ví dụ mảnh?Làm thế nào để có được thể hiện phân đoạn từ FragmentActivity?
public class MyActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle extra) {
super.onCreate(extra);
setContentView(R.layout.page_fragment);
}
}
<?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" />
hãy xem câu hỏi có liên quan của tôi: http://stackoverflow.com/questions/24833912/refresh-fragment-ui-from-fragmentactivity –
điều này sẽ không hoạt động nếu bạn có nhiều phiên bản của đoạn khung trên backstack. – datayeah