registerOnBackPressedConsumer

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.

The onBackPressedConsumer may not be already registered.

Parameters

lifecycleOwner

The lifecycle owner for the consumer.

onBackPressedConsumer

The consumer of back button press events.


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

See also