Skip to content

Instantly share code, notes, and snippets.

@KaustubhPatange
Created February 7, 2023 12:05
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/969e57f69d3d2cc7e37fc3b6d9d5fa7f to your computer and use it in GitHub Desktop.
Save KaustubhPatange/969e57f69d3d2cc7e37fc3b6d9d5fa7f to your computer and use it in GitHub Desktop.
class OnBackPressedDispatcher ... {
...
@MainThread
public void onBackPressed() {
Iterator<OnBackPressedCallback> iterator =
mOnBackPressedCallbacks.descendingIterator();
while (iterator.hasNext()) {
OnBackPressedCallback callback = iterator.next();
if (callback.isEnabled()) {
callback.handleOnBackPressed();
return;
}
}
if (mFallbackOnBackPressed != null) {
mFallbackOnBackPressed.run();
}
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment