Is it possible to use the new Navigation Architecture Component with DialogFragment? Do I have to create a custom Navigator?
I would love to use them with the new fe
May 2019 Update:
DialogFragment are now fully supported starting from
Navigation 2.1.0
, you can read more here and here
Old Answer for Navigation <= 2.1.0-alpha02:
I proceeded in this way:
1) Update Navigation
library at least to version 2.1.0-alpha01
and copy both files of this modified gist in your project.
2) Then in your navigation host fragment, change the name
parameter to your custom NavHostFragment
3) Create your DialogFragment
subclasses and add them to your nav_graph.xml
with:
4) Now launch them from fragments or activity with
findNavController().navigate(R.id.my_dialog)
or similar methods.