I am using the new Navigation component from Android Jetpack.
The root Activity setup is quite simple:
override fun onCreate(savedInstanceState: Bund
You can add addOnNavigatedListener inside your activity, and based on current destination change the title
findNavController(nav_host_fragment).addOnNavigatedListener { controller, destination ->
when(destination.id) {
R.id.destination1 -> {
my_toolbar.title= "Some title"
}
R.id.destination2 -> {
my_toolbar.title= "Othertitle"
}
}
}