Skip to content

Instantly share code, notes, and snippets.

@NezSpencer
Created March 20, 2021 09:58
Show Gist options
  • Save NezSpencer/9b622017e99022e2251f0ab902f40d95 to your computer and use it in GitHub Desktop.
Save NezSpencer/9b622017e99022e2251f0ab902f40d95 to your computer and use it in GitHub Desktop.
Recreating the multiple click action that happens when a screen lags causing the "navigation action not found" error
package com.nezspencer.navigationtest
import android.os.Bundle
import android.view.View
import androidx.fragment.app.Fragment
import androidx.navigation.fragment.findNavController
import kotlinx.android.synthetic.main.fragment_one.*
class FragmentOne : Fragment(R.layout.fragment_one) {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
btn_open_screen_two.setOnClickListener {
performDoubleClick()
}
}
private fun performDoubleClick() {
for (i in 1 downTo 0) {
findNavController().navigate(FragmentOneDirections.actionFragmentOneToFragmentTwo())
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment