To use multiple arguments for a data binding adapter the Java syntax is
@BindingAdapter(value={"arg1", "arg2"}, requireAll = false)
However this does not compile in Kotlin:
Error:(13, 37) Unexpected tokens (use ';' to separate expressions on the same line)
what's the correct syntax for multiple arguments in Kotlin?
Binding adapters are responsible for making the appropriate framework calls to set values. One example is setting a property value like calling the setText() method. Another example is setting an event listener like calling the setOnClickListener() method.
To create a custom binding adapter, you need to create an extension function of the view that will use the adapter. Then, you add the @BindingAdapter annotation. You have to indicate the name of the view attribute that will execute this adapter as a parameter in the annotation.
Or you can just simply do this
@BindingAdapter("arg1", "agr2", "agr3", "agr4", requireAll = false)
as pointed in Android Official Docs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With