Skip to content

Instantly share code, notes, and snippets.

@ErikMedina
Last active December 25, 2021 12:20
Show Gist options
  • 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