Advertisement

TrimwebsolutionsTrimwebsolutions

Problem and Solutions

What is the best way to avoid accidental repeated clicks on Any btn in android ?

By M.K. Verma · 4 May 2022

What is the best way to avoid accidental repeated clicks on Any btn in android ?
​fun​ NavController.​safeNavigate​(​direction​:​ ​NavDirections​) {​    
       currentDestination?.getAction(direction.actionId)?.​run​ { navigate(direction) }
​}

And instead of navController.navigate, use navController.safeNavigate with the same arguments.