Is it possible to use methods from Kotlin stdlib in xml? For example this code
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:textColor="#333333"
android:text="@{viewModel.note}"
android:visibility="@{viewModel.note.isNotEmpty ? View.VISIBLE : View.GONE}"/>
produce compilation error
Execution failed for task ':app:compileDevDebugJavaWithJavac'. java.lang.RuntimeException: Found data binding errors. ****/ data binding error ****msg:cannot find method isNotEmpty() in class java.lang.String file:D:\Projects\PushTracker-Android\app\src\main\res\layout\fragment_appointment_simple_details.xml loc:104:44 - 104:70 ****\ data binding error ****
It is obvious that databinding tries to find method isNotEmpty()
in Java's String but can I force databinding compiler to use kotlin's String?