Skip to content

//workflow/com.squareup.workflow1.ui.androidx/WorkflowAndroidXSupport/lifecycleOwnerFromViewTreeOrContext

lifecycleOwnerFromViewTreeOrContext

[androidJvm]
Content
@WorkflowUiExperimentalApi()

fun lifecycleOwnerFromViewTreeOrContext(view: View): LifecycleOwner?
More info

Tries to get the parent lifecycle from the current view via ViewTreeLifecycleOwner, if that fails it looks up the context chain for a LifecycleOwner, and if that fails it just returns null. This differs from ViewTreeLifecycleOwner.get because it will check the View.getContext if no owner is found in the view tree.