I'm trying to use Kotlin extension methods inside Android's databinding. For example; calling an onclick handler. So I've made this code: posttest_list_item.xml
Solution 1:
Unfortunately you can't use extension methods as onClick callbacks.
Extension methods in Kotlin are created as Java static methods while the Android framework is expecting an instance method.
Note that in Android Studio you can decompile the Kotlin classes as Java to see the generated Java code.
Post a Comment for "Kotlin Databinding With Extension Methods"