How to bind method on RadioGroup on checkChanged event with data-binding
<p>I was searching over the internet for how to perform the new cool android data-binding over the <code>RadioGroup</code> and I didn't find a single blog post about it. </p>

<p>Its a simple scenario, based on the radio button selected, I want to attach a callback event using android data binding. I don't find any method on the xml part which allows me to define a callback.</p>

<p>Like here is my RadioGroup:</p>

<pre><code>      &lt;RadioGroup
            android:id="@+id/split_type_radio"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:checkedButton="@+id/split_type_equal"
            android:gravity="center"
            &lt;!-- which tag ? --&gt;
            android:orientation="horizontal"&gt;

           ...

       &lt;/RadioGroup&gt;
</code></pre>

<p>How do I attach a handler method which will be called on <code>RadioGroup</code>'s <code>checkChnged</code> event will fire using data-binding?</p>

<p>I have tried using <code>onClick</code> (don't know if it is the same) in layout file and defining method in the Activity and located it using this in the layout file:</p>

<pre><code>   &lt;variable
        name="handler"
        type="com.example.MainActivity"/&gt;

  ...
   &lt;RadioGroup
        android:onClick="handler.onCustomCheckChanged"
        .. &gt;
</code></pre>

<p>And defined method <code>onCustomCheckChanged</code> like this:</p>

<pre><code>public void onCustomCheckChanged(RadioGroup radio, int id) {
     // ...
}
</code></pre>

<p>But, it gives me the compilation error:</p>

<blockquote>
  <p>Error:(58, 36) Listener class android.view.View.OnClickListener with method onClick did not match signature of any method handler.onCustomCheckChanged </p>
</blockquote>

<p>I have seen many blogs mentioning it is possible with <code>RadioGroup</code> but non of them really say how. How can I handle this with <code>data-binding</code> ? </p>