Skip to content

Instantly share code, notes, and snippets.

@NezSpencer
Created March 26, 2021 08:02
Show Gist options
  • Save NezSpencer/4db0725c4b3ad27fa263754aa81c34fd to your computer and use it in GitHub Desktop.
Save NezSpencer/4db0725c4b3ad27fa263754aa81c34fd to your computer and use it in GitHub Desktop.
Using the safeNavigate extension method
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
btn_open_screen_two.setOnClickListener {
findNavController().safeNavigate(FragmentOneDirections.actionFragmentOneToFragmentTwo())
}
btn_double_click.setOnClickListener {
performDoubleClick()
}
}
private fun performDoubleClick() {
for (i in 1 downTo 0) {
btn_open_screen_two.performClick()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment