Fixed
Status Update
Comments
jb...@google.com <jb...@google.com>
ap...@google.com <ap...@google.com> #2
Can you explain your use case?
ap...@google.com <ap...@google.com> #3
I can explain my one. I have a navhost fragment, where I load a graph with just one instance of a screen of acceptance of terms of use. After the approval of the user I load the real nav graph into the same navhost. According to the documentation The current data of the graph should be reset, so the new Navigation items can be reached. But unfortunately the new items from the graph cannot be reached.
jb...@google.com <jb...@google.com> #4
Re #3 - that's not how you should be doing conditional navigation (see the documentation: https://developer.android.com/topic/libraries/architecture/navigation/navigation-conditional ), but we should take a closer look at this anyways.
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.