Skip to content Skip to sidebar Skip to footer

How To Navigate From Dialog To Fragment In Navigation Component?

I am trying to navigation from DialogFragment to Fragment in Navigation Component, but getting weird result. When I navigate from DialogFragment to Fragment, background fragment i

Solution 1:

Thanks @musooff for filing this bug

This problem was fixed on Navigation 2.1.0-alpha06, along with others dialog inconsistencies like back button when Dialog is popped.

However, update to 2.1.0-beta02 or higher if you can.

Solution 2:

You could use

view.getDialog().dismiss(); 

after navigate to B. But in that way, dialog won't be visible when you came back to A fragment.

If you really want it to be visible, maybe you should try to use Fragment and pretend it to be Dialog. Like in these example with activity link.

Post a Comment for "How To Navigate From Dialog To Fragment In Navigation Component?"