Data binding: set property if it isn't null : <p>Cannot understand... How to set some property of view only if variable field isn't null?
<br>For example</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;layout xmlns:android="http://schemas.android.com/apk/res/android"&gt;

    &lt;data&gt;
        &lt;variable
            name="item"
            type="com.test.app.Item" /&gt;
    &lt;/data&gt;

    &lt;RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:orientation="horizontal"&gt;

        &lt;ImageView
            android:id="@+id/icon"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_centerVertical="true"
            android:layout_margin="16dp"
            android:src="@{item.getDrawable()}"/&gt;

        &lt;LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_marginEnd="16dp"
            android:layout_marginLeft="72dp"
            android:layout_marginRight="16dp"
            android:layout_marginStart="72dp"
            android:layout_toLeftOf="@id/action"
            android:layout_toStartOf="@id/action"
            android:orientation="vertical"&gt;

            &lt;TextView
                android:id="@+id/text1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:singleLine="true"
                android:textColor="@color/black_87"
                android:textSize="16sp"
                android:text="@{item.getTitle()}"/&gt;

            &lt;TextView
                android:id="@+id/text2"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:autoLink="web|email"
                android:linksClickable="false"
                android:singleLine="true"
                android:textColor="@color/black_54"
                android:textSize="14sp"
                android:text="@{item.getSubtitle()}"/&gt;


        &lt;/LinearLayout&gt;

    &lt;/RelativeLayout&gt;
&lt;/layout&gt;
</code></pre>

<p>Some field of Item can be null and I won't call methods of layout views unnecessarily. And I won't get <code>NullPointerException</code>. How can I set property only if it isn't null?
<br>P.S. Sorry for English.</p>
