title: How do I format a double using Android view data bindings?
body: <p>Say I have an <code>Earthquake</code> class which has a field <code>public final double magnitude;</code>, and I have a layout similar to this one:</p>
  
  <pre><code>&lt;layout xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;data&gt;
          &lt;variable name="earthquake" type="com.example.Earthquake"/&gt;
      &lt;/data&gt;
      &lt;LinearLayout
          android:orientation="horizontal"
          android:layout_width="match_parent"
          android:layout_height="48dp"&gt;
  
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="match_parent"
              android:text="@{String.format(earthquake.magnitude)}" /&gt;
          ...
      &lt;/LinearLayout&gt;
  &lt;/layout&gt;
  </code></pre>
  
  <p>Note I have to use <code>"@{String.format(earthquake.magnitude)}"</code> to use this field, else I get this error:</p>
  
  <blockquote>
    <p>Cannot find the setter for attribute 'android:text' on android.widget.TextView with parameter type double.</p>
  </blockquote>
  
  <p>Unfortunately, this results in the double being printed at full accuracy. How can I format the double value that is shown?</p>