버튼 클릭시 firebase에 존재 유무 체크하고, 있다면 정보를 가져와 다음 프래그먼트로 이동하는
간단한 코드입니다만... 버튼을 두번이상 연속으로 누르면 오류가 뜨면서 앱이 죽습니다..
이런 경우 어찌 해결해야할지 궁금합니다...ㅎ
nextButton.setOnClickListener { check(edit.text.toString()) }
|
private fun check(name: String) = MainScope().launch {
if (viewModel.check(name)) {
viewModel.getAllData(name)
navController.navigate(R.id.nextFragment)
} else
Toast.makeText(context, "틀렸습니다." , Toast.LENGTH_SHORT).show()
}
|
viewModel에서 firebase 통신은 withContext(Dispatcher.IO) 로 지정해두었고
해당 오류입니다
java.lang.IllegalArgumentException: Navigation action/destination ~~~:id/~~~ cannot be found from the current destination Destination