Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to dismiss dialog fragment started via Android Navigation library

In Navigation 2.1.0-alpha03 they added functionality to navigate to a DialogFragment with <dialog> tag.

However, how can the source fragment/activity then dismiss this dialog fragment? Its very easy to do this in pure AOSP android with dialogFragment.dismiss(), but I don't see an accompanying way in Navigation library.

like image 796
tir38 Avatar asked Aug 08 '19 21:08

tir38


1 Answers

findNavController().navigateUp() is the one what you are looking for.

<dialog> is treated same as <fragment>. Controlling destinations are all identical.

like image 97
musooff Avatar answered Oct 17 '22 13:10

musooff