jitinsharma
08/12/2020, 3:16 PMViewGroup.setContent
extension inside a BottomSheetDialog
and it threw this exception
java.lang.IllegalStateException: Composed into the View which doesn't propagate ViewTreeLifecycleOwner!
Is this a known issue?Ian Lake
08/12/2020, 8:04 PMBottomSheetDialogFragment
and overriding onCreateView()
to create your View? Fragment, and by extension any DialogFragment
, will have its LifecycleOwner setDialog
, that view hierarchy is in its own window and is totally uncoupled from the Activity's.jitinsharma
08/13/2020, 1:54 AMBottomSheetDialog
private val dialog = BottomSheetDialog(context)
val layout = LayoutInflater.from(context).inflate(R.layout.filter_bottom_sheet_dialog_view, null)
dialog.setContentView(layout)
layout.findViewById<CardView>(R.id.v_card).setContent(Recomposer.current()) {
FiltersScreen(filterState = filterState)
}
Ian Lake
08/13/2020, 2:58 AMset
method is for. You'll also want to hook up the other ViewTree APIsjitinsharma
08/13/2020, 3:02 AMset
methods.
BottomSheetDialogFragment
looks an obvious better choice then(funny didn't think of this earlier 😅)louiscad
11/27/2022, 11:31 AMYou'll also want to hook up the other ViewTree APIsWhat did you mean?
Vinay Gaba
12/02/2022, 10:49 PM