https://kotlinlang.org logo
#compose
Title
# compose
a

Aaron Waller

08/02/2022, 1:54 PM
Why is my snackbar always calling Dismissed but never ActionPerformed?
Copy code
scope.launch {
                        val snackbarResult = scaffoldState.snackbarHostState.showSnackbar(
                            "Grant permission to modify device audio",
                            actionLabel = "Settings"
                        )
                        when (snackbarResult) {
                            SnackbarResult.Dismissed -> Log.d("SnackbarDemo", "Dismissed")
                            SnackbarResult.ActionPerformed -> Log.d("SnackbarDemo", "Snackbar's button clicked")
                        }
                    }
I want to launch an Intent on the “Settings” label click but it calls Dismissed when I click the label of the SnackBar. What am I doing wrong? When is it calling ActionPerformed?