I have the following XML with data binding:
<EditText
android:id="@+id/addvalue"
android:inputType="numberDecimal"
android:digits="0123456789,€"
android:text="0,00 €"/>
<Button
android:id="@+id/add"
android:onClick="@{() -> fragment.addManualPosition(addvalue.text)}"/>
I get the error
"data binding error ****msg:if getId is called on an expression, it should have an id: addvalue.text"
I can not find anything at all that would help me understand what this error is supposed to mean or how to fix it.
I found it myself. However because there is absolutely nothing written about this error message and it being extremely misleading, I'll keep the question online.
Fix: The lambda is a perfectly fine Kotlin lambda. However Data Binding seems to generate Java code. So it must not be addvalue.text but addvalue.getText() .
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