Skip to content

Instantly share code, notes, and snippets.

@ErikMedina
Last active December 25, 2021 12:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ErikMedina/d6623364f2fca109ce86bc4f1ed45da5 to your computer and use it in GitHub Desktop.
Save ErikMedina/d6623364f2fca109ce86bc4f1ed45da5 to your computer and use it in GitHub Desktop.
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