Gaurav Tyagi
05/08/2022, 6:33 PM@Composable
fun CastMiniController(modifier: Modifier = Modifier) {
AndroidViewBinding(factory = { inflater, parent, attachToParent ->
val binding = FragmentCastMiniControllerBinding.inflate(inflater, parent, false)
binding
}, modifier.fillMaxWidth().wrapContentHeight())
}
xml file
<?xml version="1.0" encoding="utf-8"?>
<androidx.fragment.app.FragmentContainerView xmlns:android="<http://schemas.android.com/apk/res/android>"
android:id="@+id/castMiniController"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:tag="miniControllerFragment"
android:name="com.google.android.gms.cast.framework.media.widget.MiniControllerFragment">
</androidx.fragment.app.FragmentContainerView>
after adding it getting below crash
E/AndroidRuntime: FATAL EXCEPTION: main
android.view.InflateException: Binary XML file line #2 in layout/fragment_cast_mini_controller: Binary XML file line #2 in /cast_mini_controller: Views added to a FragmentContainerView must be associated with a Fragment. View android.widget.LinearLayout{6809a66 V.E...... ......I. 0,0-0,0 #7f0a0176 app:id/container_all} is not associated with a Fragment.
Caused by: android.view.InflateException: Binary XML file line #2 in /cast_mini_controller: Views added to a FragmentContainerView must be associated with a Fragment. View android.widget.LinearLayout{6809a66 V.E...... ......I. 0,0-0,0 #7f0a0176 app:id/container_all} is not associated with a Fragment.
Caused by: java.lang.IllegalStateException: Views added to a FragmentContainerView must be associated with a Fragment. View android.widget.LinearLayout{6809a66 V.E...... ......I. 0,0-0,0 #7f0a0176 app:id/container_all} is not associated with a Fragment.
at androidx.fragment.app.FragmentContainerView.addView(FragmentContainerView.kt:266)