STAR-ZERO / navigation-keep-fragment-sample

392 stars 63 forks source link

findNavController().currentDestination seems incorrect #26

Open tatsuyafujisaki opened 4 years ago

tatsuyafujisaki commented 4 years ago

First, thanks for sharing the great navigation sample.

Adding a logger as follows ...

class DashboardFragment : Fragment() {
    // ...
    override fun onCreateView(...): View? {
        Log.d("DashboardFragment", findNavController().currentDestination?.label.toString())
    }
    // ...
}

... shows the log below.

D/DashboardFragment: NotificationsFragment

The expected behavior is as follows:

D/DashboardFragment: DashboardFragment