OnBackPressedConsumerOwner

A helper class for managing multiple OnBackPressedConsumers.

Constructors

Functions

Link copied to clipboard
open override fun onBackPressed(): Boolean

Propagates a back press event across a list of consumers. This starts by offering the event to the first consumer and passing it on to the next, until a consumer returns true.

Link copied to clipboard
fun registerOnBackPressedConsumer(lifecycleOwner: LifecycleOwner, onBackPressedConsumer: OnBackPressedConsumer)

Registers a new consumer for back button press events. onBackPressedConsumer is bound to lifecycleOwner. It is called only if lifecycleOwner is at least in the Lifecycle.State.STARTED state.

fun registerOnBackPressedConsumer(lifecycleOwner: LifecycleOwner, onBackPressedConsumer: () -> Boolean)