Cannot understand... How to set some property of view only if variable field isn\'t null?
For example
Data binding does not need to check for null value, it will be handled by binding class.
If you need to check null for other purpose (like setting default value) then you can use like this.
android:text='@{item.gender != null ? item.gender : @string/male}'
or
android:text='@{item.gender ?? @string/male}'
Both above examples are same. Here @string/male
is default value, when item.gender
is null
.