Android/Kotlin: A FloatingActionButton setOnClickListener Snackbar example

As a quick note to self, this is an example of how to implement a setOnClickListener on a FloatingActionButton with Android and Kotlin:

fab.setOnClickListener { view ->
    Snackbar.make(
        view,
        "An exciting message!",
        Snackbar.LENGTH_LONG
    ).setAction("Action", null).show()
}

Hopefully that’s enough to get “future me” pointed in the right direction when I need this again. :)

(There are more lambda details at this link.)