Added in API level 34

OnBackAnimationCallback


interface OnBackAnimationCallback : OnBackInvokedCallback
android.window.OnBackAnimationCallback

Interface for applications to register back animation callbacks along their custom back handling.

This allows the client to customize various back behaviors by overriding the corresponding callback methods.

Callback instances can be added to and removed from OnBackInvokedDispatcher, which is held at window level and accessible through Activity#getOnBackInvokedDispatcher(), Dialog#getOnBackInvokedDispatcher(), Window#getOnBackInvokedDispatcher() and View#findOnBackInvokedDispatcher().

When back is triggered, callbacks on the in-focus window are invoked in reverse order in which they are added within the same priority. Between different priorities, callbacks with higher priority are invoked first.

Summary

Public methods
open Unit

Called when a back gesture or back button press has been cancelled.

open Unit

Called when a back gesture progresses.

open Unit

Called when a back gesture has been started, or back button has been pressed down.

Inherited functions

Public methods

onBackCancelled

Added in API level 34
open fun onBackCancelled(): Unit

Called when a back gesture or back button press has been cancelled.

onBackProgressed

Added in API level 34
open fun onBackProgressed(backEvent: BackEvent): Unit

Called when a back gesture progresses.

Parameters
backEvent BackEvent: An BackEvent object describing the progress event. This value cannot be null.

onBackStarted

Added in API level 34
open fun onBackStarted(backEvent: BackEvent): Unit

Called when a back gesture has been started, or back button has been pressed down.

Parameters
backEvent BackEvent: The BackEvent containing information about the touch or button press. This value cannot be null.