I am using ternary operator on observable field to set the text to textview in xml.But its gives me following error at compile time.
****/ data binding error ****msg:The expression ((vmEnteredAmountGetJavaLangString0) ? ("") : (vmEnteredAmountGet)) cannot be inverted: The condition of a ternary operator must be constant: android.databinding.tool.writer.KCode@1a6539af
Below is my code:
<EditText
android:id="@+id/txtAmount"
style="@style/AmountText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text='@={vm.enteredAmount.get()=="0"?"":vm.enteredAmount}'
app:decimalLen='@{6}' />
Any help will be appreciated.Thank you.