NavController.OnDestinationChangedListener is not triggered during Navigation

11 Views Asked by At

In my project I have a simple Navigation Graph, **addOnDestinationChangedListener ** working fine but after the code click **addOnDestinationChangedListener ** is not trigger but navigation action did execute

 CoroutineScope(Dispatchers.IO).launch {
            kotlin.runCatching { Constants.getBitmapFromView(binding.frameLayout) }.onSuccess {
                kotlin.runCatching {
                    mBitmap = it
                    findNavController().navigate(R.id.previewFragment)
                }
            }
        }

If i change the clickListener to navigate then its working fine,but i need to trigger

navController.addOnDestinationChangedListener { _, destination, _ ->

}
0

There are 0 best solutions below