1 year ago
#384438
Celine L.
How do I re-enable Bottom Navigation after using findNavController().navigate()?
Im working on an app with 4 Bottom Navigation fragments and want to have a dialog where one of the buttons within it directly navigates the user from the current fragment, which is listed on the bottom-navigation-bar to another fragment listed on the bottom-navigation-bar (To make the app more user friendly). I've tried using
rootView.preset_to_dice_tray_button.setOnClickListener {
findNavController().navigate(R.id.navigation_presets)
dismiss()
}
to do so, and it does navigate to the correct fragment, but thereafter prevents the user from navigating back to the originating fragment via the bottom-navigation-bar. All the other options on the bottom-navigation-bar still work as intended in this state, and the only way to get back to the originating fragment seems to be the back button.
After some googling I found This Question which seemed reasonably close to the problem I'm facing, but the code
rootView.preset_to_dice_tray_button.setOnClickListener {
childFragmentManager.beginTransaction().replace(R.id.navigation_roll,
PresetsFragment()).commit()
dismiss()
}
just crashes my app when the button is clicked.
I've also tried to gain some insight into the issue by adding Logs to the originating fragments onResume() and onStart() functions, but those functions arn't even called when clicking the corresponding bottom-navigation-bar icon.
I'm a bit out of my depth at this point, can anyone here help me figure out how to do this without causing this bug?
android
kotlin
android-fragments
bottomnavigationview
0 Answers
Your Answer