Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

OnBackPressedCallback

interface OnBackPressedCallback
androidx.activity.OnBackPressedCallback

Interface for handling OnBackPressedDispatcher#onBackPressed() callbacks without strongly coupling that implementation to a subclass of ComponentActivity.

Summary

Public methods
abstract Boolean

Callback for handling the OnBackPressedDispatcher#onBackPressed() event.

Public methods

handleOnBackPressed

abstract fun handleOnBackPressed(): Boolean

Callback for handling the OnBackPressedDispatcher#onBackPressed() event.

Return
Boolean: True if you handled the OnBackPressedDispatcher#onBackPressed() event. No further OnBackPressedCallback instances will be called if you return true.