Fixed
Status Update
Comments
jb...@google.com <jb...@google.com>
ap...@google.com <ap...@google.com> #2
Thanks for reporting this and providing some code snippets! Additionally, if you have a project I would be able to clone that reproduces the issue it would definitely help as well!
ap...@google.com <ap...@google.com> #3
You can clone this:
Run the Main Activity, scroll to the end of the list: I join a screen of the issue.
jb...@google.com <jb...@google.com> #4
Thanks for providing a sample project! Looks like this is an issue with how we conflate item accesses when triggering prefetch.
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.