I found that when my fragment was defined in the navigation graph with a <fragment>
tag (for a full screen dialogfragment), the dialogfragment would not dismiss with the dismiss()
command. Instead, I had to pop the back stack:
findNavController(getActivity(), R.id.nav_host_fragment).popBackStack();
However, if the same dialogfragment was defined in the navigation graph with a <dialog>
tag, dismiss()
works fine.