How can I hide the back and hamburger buttons inside LanguageFragment?

Viewed 25

The languageFragment is the start destination

<navigation app:startDestination="@id/languageFragment">

The user when opening the app will choose the language first and after choosing the language, I'll navigate him to homeFragment

What is the problem?

The languageFragment is the start destination so it must not show the back button in the toolbar, but unfortunately, the back button appears.

Here is what I tried:

The back button will not show inside the languageFragment and it will show the hamburger button instead. (Not as what I want)

NavigationUI.setupWithNavController(toolbar, navController, 
    new AppBarConfiguration.Builder(R.id.homeFragment, R.id.languageFragment).setOpenableLayout(drawerLayout).build());

The back button will not show inside the homeFragment and it will show the hamburger button instead. (Working perfectly)

NavigationUI.setupWithNavController(toolbar, navController, 
    new AppBarConfiguration.Builder(R.id.homeFragment).setOpenableLayout(drawerLayout).build());

What am I trying to achieve?

  • The back and hamburger button should not show inside the languageFragment.
  • The back button should not show inside the homeFragment and should show the hamburger button instead.

Thank you.

0 Answers
Related