WAI
Status Update
Comments
as...@gmail.com <as...@gmail.com> #2
il...@google.com <il...@google.com> #3
va...@gmail.com <va...@gmail.com> #4
Thx, OnNavigationItemReselectedListener does it.
va...@gmail.com <va...@gmail.com> #5
But just curious, was there any reason to create a new instance of the fragment as a default behavior?
ar...@gmail.com <ar...@gmail.com> #6
Well, I assume that bottom navigation should "cache" fragments. We can do that manually, but with Navigation library right now every time I go to another tab and return, it recreates the previous fragment.
il...@google.com <il...@google.com> #7
Navigation only stores the state of Fragments on the back stack. Multiple back stacks and supporting restoring a bottom tab in its previous position is being covered in https://issuetracker.google.com/issues/80029773
te...@gmail.com <te...@gmail.com> #8
This worked for me.
Description
Version used: 1.0.0-beta01
Devices/Android versions reproduced on: Android Pie, Pixel 2 XL
Clicking on the same menu item of BottomNavigationView creates a new fragment and destroys previously created fragment. Please consider this as a no-op and ignore these duplicate requests.
BottomNavigationView is set using NavigationUI.
NavigationUI.setupWithNavController( findViewById<BottomNavigationView>(R.id.bottomNavView),
findNavController(R.id.navHostFragment) )
Sample is available at