So I am trying to create a listener in Kotlin. I just want to pass a method that will be executed latter in my code. Like this:
override fun setButtonClickListener(listener: (text: String) -> Unit) {
this.listener = listener
}
But, when I declare my listener, I must declare it like this:
private var listener : (text: String) -> Unit = null!!
Otherwise my AS will complain. But this !! in a null object seams so weird. How should I declare this listener??
Thanks!