I am running into issues trying to take a function as a parameter in a binding adapter using Kotlin/Android databinding. This example code throws e: error: cannot generate
e: error: cannot generate
Put apply plugin: 'kotlin-kapt' in build.gradle
apply plugin: 'kotlin-kapt'
Then you can create Binding Adapter like
@JvmStatic @BindingAdapter("onDelayedClick") fun onDelayedClick(view: View, function: () -> Unit) { // TODO: Do something }
And XML Like
And VM Like
val testFunction = { // TODO: Do something }