OnBackInvokedCallback
interface OnBackInvokedCallback
| android.window.OnBackInvokedCallback |
Callback allowing applications to handle back events in place of the system.
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.
This replaces Activity.onBackPressed(), Dialog.onBackPressed() and android.view.KeyEvent#KEYCODE_BACK
If you want to customize back animation behaviors, in addition to handling back invocations, register its subclass instances OnBackAnimationCallback instead.
Summary
| Public methods | |
|---|---|
| abstract Unit |
Called when a back gesture has been completed and committed, or back button pressed has been released and committed. |
Public methods
onBackInvoked
abstract fun onBackInvoked(): Unit
Called when a back gesture has been completed and committed, or back button pressed has been released and committed.