Hi guys can you explain me how this works :
fun showSnack(parent : View, message : String, listener : View.OnClickListener){
Snackbar.make(parent, message, Snackbar.LENGTH_LONG)
.setAction(“Confirm”, listener)
.show()
}
and when i call this with
showSnack(parentCat, “my string”) { frag?.launchDeleteBasket() }
So i am developping in Android Studio with kotlin 1.4.0.
it works fine, but my third argument was an OnCLickListener, and why it put the third argument outside. Normally my third argument should be a
() → Unit
. But if I do so it will not work because setAction() require View.OnClickListener.
Thanx