Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Custom back navigation
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
requireActivity().onBackPressedDispatcher.addCallback(viewLifecycleOwner) {
findNavController().navigate(R.id.action_firstFragment_to_homeFragment)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment