Toolbar navigation is overridden

Thank you for your quick response. I did try your suggestion and it works in the sample app but not in our huge app with dozens and dozens of pages. It seems as though the PdfViewCtrlTabHostFragment2 has completely ruined the connection of our navController with the toolbar. Adding this to our app didn’t work in our actual app:

binding.appBar.appToolbar.toolbar.navigationIcon = null
binding.appBar.appToolbar.toolbar.title = destination.label

You can see in the attached image that the toolbar still has the icon and title of the opened .pdf when navigating back. The PdfViewCtrlTabHostFragment2 even messed with the theming of the TabLayout :cry:.

This code connects the two on app start in our MainActivity using the androidx navigation framework:

appBarConfiguration =
     AppBarConfiguration(
         setOf(
                    R.id.dashboard_fragment,
                    R.id.nav_contacts,
                    R.id.nav_files
         )
)
setSupportActionBar(binding.appBar.appToolbar.toolbar)
setupActionBarWithNavController(navController, appBarConfiguration)

The AppBarConfiguration registers the root level destinations and the setupActionBarWithNavController registers the navigation.xml that the navController uses with the supportActionBar (toolbar). This automatically updates the navigation icon and title of the page in the toolbar upon navigation based on the fragment’s label determined in the navigation.xml (it’s mobile_navigation.xml in the sample app).

Something with the PDFTron Fragment code is messing with the Support Action Bar of the Activity instead of just its own fragment. This is then making the androidx navigation no longer be hooked up to the supportActionBar. We manage two very big apps with dozens of pages in both. It would be very tedious and undesirable to have to re implement a “hacky” workaround navigation just because of replacing a FrameLayout with the PdfViewCtrlTabHostFragment2 in a couple places in the app… :frowning:

Are there any other options to disable the navigation of the PdfViewCtrlTabHostFragment2? I’ve even tried using the PdfViewCtrlTabHostFragment2.TabHostListener's override fun onNavButtonPressed() but that didn’t work either :cry: