title: Difference between import and variable when Data Binding?
body: <p>After reviewing <a href="https://developer.android.com/topic/libraries/data-binding/expressions#imports_variables_and_includes" rel="nofollow noreferrer">Data Binding documentation</a> on the difference between <code>&lt;import/&gt;</code> and <code>&lt;variable/&gt;</code>, it's unclear how they differ. Below are examples taken from the documentation page.</p>
  
  <pre><code>&lt;import type="com.example.real.estate.View" alias="Vista"/&gt;
  </code></pre>
  
  <p>looks like the equivalent of </p>
  
  <pre><code>&lt;variable name="user" type="com.example.User"/&gt;
  </code></pre>
  
  <p>except that an <code>alias</code> can start with a capital letter, while <code>name</code> cannot. They are even used similarly.</p>
  
  <pre><code>&lt;data&gt;
      &lt;import type="com.example.MyStringUtils"/&gt;
      &lt;variable name="user" type="com.example.User"/&gt;
  &lt;/data&gt;
  …
  &lt;TextView
     android:text="@{MyStringUtils.capitalize(user.lastName)}"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"/&gt;
  </code></pre>
  
  <p>The only difference I'm seeing, from the examples, are that you can call an <code>import</code>'s methods, but not a <code>variable</code>'s.</p>