Skip to content

Instantly share code, notes, and snippets.

@PHELAT
Last active May 10, 2019 21:31
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 PHELAT/87f993adb9b4330e8e96cb3a3e15b035 to your computer and use it in GitHub Desktop.
Save PHELAT/87f993adb9b4330e8e96cb3a3e15b035 to your computer and use it in GitHub Desktop.
navigateUp with Bundle!
class FragmentA : BundleFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
myButton.setOnClickListener {
navigate(FragmentADirections.fragmentAToFragmentB(), REQUEST_CODE)
// If you aren't using SafeArgs plugin, you can navigate with direction id
navigate(R.id.fragmentAToFragmentB, REQUEST_CODE)
}
}
companion object {
const val REQUEST_CODE = 1000
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment