Skip to content

Instantly share code, notes, and snippets.

@KaustubhPatange
Last active February 8, 2023 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KaustubhPatange/3dcd34df3f5f26fe884ab2166a6c815b to your computer and use it in GitHub Desktop.
Save KaustubhPatange/3dcd34df3f5f26fe884ab2166a6c815b to your computer and use it in GitHub Desktop.
onBackInvokedDispatcher.registerOnBackInvokedCallback(1000, object: OnBackInvokedCallback {
override fun onBackInvoked() {
// perform any action
...
// finally call the remaining callbacks or just `onBackPressed()` both are same.
// if no callback is registered it will fallback to app.Activity -> onBackPressed()
onBackPressedDispatcher.onBackPressed()
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment