I searched on the Internet how to perform a new reliable binding of Android data to RadioGroup, and I did not find a single blog post about this.
Its a simple script based on the selected button, I want to add a callback event using data binding to android. I do not find any method in the xml part that allows me to define a callback.
Like my radio group:
<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"
<!-- which tag ? -->
android:orientation="horizontal">
...
</RadioGroup>
How to add a handler method that will be called in the event RadioGroup checkChngedwill fire using data binding?
I tried to use onClick(I don't know what it is the same) in the layout file and define a method in the Activity and placed it using this in the layout file:
<variable
name="handler"
type="com.example.MainActivity"/>
...
<RadioGroup
android:onClick="handler.onCustomCheckChanged"
.. >
onCustomCheckChanged :
public void onCustomCheckChanged(RadioGroup radio, int id) {
}
:
: (58, 36) android.view.View.OnClickListener onClick - handler.onCustomCheckChanged
, , RadioGroup, , . data-binding?