when do onbackpressed in fragment android code example
Example: onbackpressed android fragment
requireActivity().onBackPressedDispatcher.addCallback(viewLifecycleOwner) {
findNavController().navigate(R.id.mainFragment)
}
requireActivity().onBackPressedDispatcher.addCallback(viewLifecycleOwner) {
findNavController().navigate(R.id.mainFragment)
}