In my UI I have a RadioGroup with 3 RadioButtons and a "normal" Button.
When the user clicks on the Button I want to read the selected RadioButton to do something with it.
RxView.clicks(button)
.flatMap(x -> RxRadioGroup.checkedChanges(radioGroup_timer))
.map(view -> {
switch (view) {
case R.id.radioButton_10sec_timer:
return 10;
case R.id.radioButton_20sec_timer:
return 20;
default:
return DEFAULT_TIMER;
}
})
.subscribe(duration -> Timber.i("duration: %,d",duration));
It works so far but now every time the user selects an other RadioButton I get a new log message.
Is there a way to read the current selected RadioButton without subscribing for changes?