activity

@JvmName(name = "activityTyped")
inline fun <T : Activity> LifecycleOwner.activity(): T?

Returns the Activity this LifecycleOwner is attached to, or null if it is not attached to an Activity.

Receiver

the current LifecycleOwner.

Return

T or null.

See also


Returns the Activity this LifecycleOwner is attached to, or null if it is not attached to an Activity.

An Activity or a Fragment that is attached to an Activity can be used as a LifecycleOwner.

Receiver

the current LifecycleOwner.

Return

Activity or null.

See also