In my user interface I have RadioGroupwith 3 RadioButtonsand "normal" Button.
When the user clicks on Button, I want to read the selected RadioButtonone 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 still works, but now every time the user selects another RadioButton, I get a new log message.
Is there a way to read the current selection RadioButtonwithout subscribing to the changes?
source
share