Код: Выделить всё
Activity -opens-> BottomSheetDialogFragment -inflates-> CustomView -inflates-> FragmentContainerView -inflates-> Fragment -inflates-> a few views
Код: Выделить всё
java.lang.RuntimeException: Unable to resume activity {com.example.nestedfragments/com.example.nestedfragments.MainActivity}: android.view.InflateException: Binary XML file line #10 in com.example.nestedfragments:layout/fragment_main_dialog: Binary XML file line #10 in com.example.nestedfragments:layout/fragment_main_dialog: Error inflating class com.example.nestedfragments.ContainerView
Caused by: android.view.InflateException: Binary XML file line #10 in com.example.nestedfragments:layout/fragment_main_dialog: Binary XML file line #10 in com.example.nestedfragments:layout/fragment_main_dialog: Error inflating class com.example.nestedfragments.ContainerView
Caused by: android.view.InflateException: Binary XML file line #10 in com.example.nestedfragments:layout/fragment_main_dialog: Error inflating class com.example.nestedfragments.ContainerView
Caused by: java.lang.reflect.InvocationTargetException
Caused by: android.view.InflateException: Binary XML file line #13 in com.example.nestedfragments:layout/view_container: Binary XML file line #13 in com.example.nestedfragments:layout/view_container: Error inflating class androidx.fragment.app.FragmentContainerView
Caused by: android.view.InflateException: Binary XML file line #13 in com.example.nestedfragments:layout/view_container: Error inflating class androidx.fragment.app.FragmentContainerView
Caused by: java.lang.IllegalStateException: FragmentManager is already executing transactions
Код: Выделить всё
MainActivity
MainDialogFragment
Код: Выделить всё
class MainDialogFragment : BottomSheetDialogFragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
return FragmentMainDialogBinding.inflate(inflater, container, false).root
}
}
Код: Выделить всё
Код: Выделить всё
class ContainerView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : LinearLayout(context, attrs, defStyleAttr) {
private val binding = ViewContainerBinding.inflate(LayoutInflater.from(context), this)
}
Код: Выделить всё
Код: Выделить всё
class NestedFragment : Fragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
return FragmentNestedBinding.inflate(inflater, container, false).root
}
}
Подробнее здесь: https://stackoverflow.com/questions/784 ... tainerview