I want to check the actual Fragment if it's dirty and warn the user to lose his changes. I could'nt find an Listener on the Navcontroller to interact before the navigation happens.
I already tried to set a listener to the BottomNavigationView but the result was that the Navigation does'nt work anymore after the reset.
requireActivity().bottomNavigationView.setOnNavigationItemSelectedListener{menuItem ->
DialogUtil.showBeforeLeaveDetailFragmentDialog(context!!){
requireActivity().bottomNavigationView.setOnNavigationItemSelectedListener(null)
findNavController().navigate(menuItem.itemId)
}
false
}
Is there any global Listener which i can use or another clean solution?