Flagment 의 onCreateView 에서 container 이 null 이나오는 이유가 뭐가있을까요?
xml 에서 프래그먼트를 포함시키고 디버깅해보면
onCreateView 에서 container 이 null 이나와서 죽습니다
이경우 어디를 살펴봐야될까요?
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:ignore="RtlHardcoded"
>
<fragment
android:name="wri.www.net.web.WebViewFragment"
android:id="@+id/fragment1"
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="0dip"
/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
if (container == null) { //여기로 들어옵니다
// We have different layouts, and in one of them this
// fragment's containing frame doesn't exist. The fragment
// may still be created from its saved state, but there is
// no reason to try to create its view hierarchy because it
// won't be displayed. Note this is not needed -- we could
// just run the code below, where we would create and return
// the view hierarchy; it would just never be used.
return null;
}
mCtx = getActivity();
init();
View v = init();
return v;
}