Fixed
Status Update
Comments
jb...@google.com <jb...@google.com>
ap...@google.com <ap...@google.com> #2
To reproduce the issue. Open a fragment for example then request permission. send the app to background, open it again from recent apps. it will crash with the above exception.
ap...@google.com <ap...@google.com> #3
IMPORTANT:
Please try
Studio Build: OS: Android Device model number & build number: Android SDK Platform Tools version: Attach the idea.log file via Help > Show Log in Finder.
Steps to Reproduce: 1. 2. 3.
jb...@google.com <jb...@google.com> #4
This has been fixed already in
Description
Component used: Activity
Version used: 1.7.2
As explained in the Predictive Back guide , you shouldn't use an
OnBackPressedCallback
for non-UI cases (for example, just for logging back). If you add a callback, you have to handle back completely in your callback.That means that calling
remove()
and triggering back viarequireActivity.onBackPressed()
oronBackPressedDispatcher.onBackPressed()
is always an anti-pattern and something that you should not do.It would be helpful if there was a Lint error that specifically catch this case and warn developers ahead of time that this is the wrong thing to do and offer alternatives or at least link to the guide for more information.