I've setup my bottom navigation with navHostController, I've a container activity which has a toolbar, I want to change the icon in toolbar based on which fragment I'm on, this was easy if I didn't use navigation Component library.
MainActivity
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
bottomNavigationView.setupWithNavController(dashboardNavHostFragment.findNavController())
}
I want to change the icon in the toolbar to the fragment active in the bottom navigation.