I am using the last navigation library (version 2.4.0) which include multiple backstacks with a bottom navigation view.
The default behavior is that each backstack is saved when user go back to a tab. I want to clear a backstack when the user leave a tab.
Based on this bottom nav with 3 tabs :
| Tab1 | Tab2 | Tab3 |
|---|---|---|
| ScreenA1 | ScreenB1 | ScreenC1 |
| ScreenA2 | ScreenB2 | ScreenC2 |
From Tab1, if user:
Thanks
You can turn off multiple backstacks for tabs, as it was before lib version 2.4. For this you should change
navView.setupWithNavController(navController)
to
NavigationUI.setupWithNavController(navView, navController, false)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With