Launch not executing when called inside a coroutinescope

I’m calling launch inside a coroutinescope but it does not execute. Snackbar action listener is executing but the launch block is not executing for some reason.

CoroutineScope(Dispatchers.Main).launch {
                val scope = this
                val mn = snackbarManager(R.id.root);
                Snackbar.make(mn.container, R.string.recpt_deleted, Snackbar.LENGTH_LONG)
                    .setAction(R.string.undo) {
                        scope.launch {**//not executing**
                            Toast.makeText(requireContext(),"Committing",Toast.LENGTH_LONG).show()
                            Log.d("COMMIT", "calling commit")
                           
                        }
                    }
                .show()
            }

Source: Android Questions

LEAVE A COMMENT