このフラグメントをインスタンス化すると、stackoverflow エラーが発生します。メイン アクティビティ クラスで定義されたナビゲーション ドロワーを使用して、このフラグメントを選択しようとしています。
public class MyFragment extends Fragment {
public static MyFragment newInstance() {
return new MyFragment();
}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.page_meet, container, false);
}
public void onViewCreated(View view, Bundle savedInstanceState) {
ViewPager mViewPager = (ViewPager) view.findViewById(R.id.pager);
MyFragmentPagerAdapter mViewPagerAdapter = new MyFragmentPagerAdapter(getChildFragmentManager());
mViewPager.setAdapter(mViewPagerAdapter);
}
public class MyFragmentPagerAdapter extends FragmentPagerAdapter {
public MyFragmentPagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
return newInstance();
}
@Override
public int getCount() {
return 2;
}
}
}
XML ファイル page_meet.xml は次のとおりです。
<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:background="#00FF00" >
</LinearLayout>
</android.support.v4.view.ViewPager>
Logcat はあまり有益ではありませんでした:
10-07 03:19:27.910: E/AndroidRuntime(27875): FATAL EXCEPTION: main
10-07 03:19:27.910: E/AndroidRuntime(27875): java.lang.StackOverflowError
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11890)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirection(View.java:11892)
10-07 03:19:27.910: E/AndroidRuntime(27875): at android.view.View.canResolveLayoutDirec