How to use data-binding with Fragment
<p>I'm trying to follow data-binding example from official google doc <a href="https://developer.android.com/tools/data-binding/guide.html">https://developer.android.com/tools/data-binding/guide.html</a></p>

<p>except that I'm trying to apply data-biding to a fragment, not an activity.</p>

<p>the error I'm currently getting when compiling is </p>

<p><code>Error:(37, 27) No resource type specified (at 'text' with value '@{marsdata.martianSols}.</code></p>

<p><code>onCreate</code> for fragment looks like this:</p>

<pre><code>@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    MartianDataBinding binding = MartianDataBinding.inflate(getActivity().getLayoutInflater());
    binding.setMarsdata(this);
}
</code></pre>

<p><code>onCreateView</code> for fragment looks like this:</p>

<pre><code>@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    return inflater.inflate(R.layout.martian_data, container, false);
}
</code></pre>

<p>and parts of my layout file for fragment looks like this:</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="marsdata"
            type="uk.co.darkruby.app.myapp.MarsDataProvider" /&gt;
    &lt;/data&gt;
...

        &lt;TextView
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:text="@{marsdata.martianSols}"
        /&gt;

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

<p>my suspicion is that <code>MartianDataBinding</code> doesn't know which layout file it's supposed to be bound with - hence the error. Any suggestions?</p>