Currently in my navgraph i have dialog fragment destination ( Fragment(dialog) type). When i\'m navigating to this dialog and then try to navigate to another fragment from t
As per this issue, this is working as intended:
There's a couple of problems here relating to how Dialogs and Fragments work:
Dialogs are separate windows that always sit above your activity's window. This means that the dialog will continue to intercept the system back button no matter what state the underlying FragmentManager is in or what FragmentTransactions you do.
Operations on the fragment container (i.e., your normal
<fragment>
destinations) don't affect dialog fragments. Same if you do FragmentTransactions on a nested FragmentManager.The initial release of Navigation's
<dialog>
support did not take these limitations into account and would treat dialog destinations just like any other in that, from Navigation's point of view, they could be put on the back stack and treated like any other<fragment>
destination.As that's not actually the case, we've made a few changes for Navigation 2.1.0-alpha06 to ensure that Navigation's state of the world matches what you actually see on the screen and prevent crashes like that in comment#5.
The summary of this is that
<dialog>
destinations are now automatically popped when navigate to a non-dialog and non-activity destination, such as a destination. For reference, this was done in https://android-review.googlesource.com/996359 and https://android-review.googlesource.com/1007662
So it is expected when you navigate to a non-dialog destination that any dialog destination is popped off the back stack.