I'm setup UI with Navigation Component and BottomNavigationView.
3 tabs: Home, News, Account.
When I navigate from Home to News (currently, Back stack has HomeFragment) and press Back button, fragment News will be destroyed, HomeFragment in Back stack will be destroyed too and create new HomeFragment. I expect HomeFragment in Back stack show again with not destroy and create new.
I use this code:
bottomNavigation.setupWithNavController(navHostFragment.findNavController())
How to fix this issue?
Thanks.
Update question:
When I clicked menu item, Fragment will be create new instance. I don't want that, I want to navigate to new Fragment if it hasn't been clicked yet, and the Fragment will be show again (without create new) if I click menu item again.