Closed drunkendaddy closed 6 years ago
Problem was I am using a custom toggle button, and I was able to get it to work according to my requirements by overriding toggle() method of CompoundToggleButton
@Override
public void toggle() {
if (isChecked()) {
return;
}
super.toggle();
}
You may close this issue
The OnCheckedChangeListener notifies checked event (from unchecked to checked) of any button in SingleSelectToggleGroup.
By convention a radio group should have exactly one checked button in it. If you are using the built in LabelToggle or CircularToggle, this is ensured by setting radioStyle to true when they are being added to SingleSelectToggleGroup, as shown here. Similar approach can be found in RadioButton, which forbids checked button to be unchecked.
If you want to uncheck buttons in SingleSelectToggleGroup, you can built your custom button and handle the checked/unchecked state on the button yourself.
You can also use MultiSelectToggleGroup, the OnCheckedStateChangeListener will notify any change, but you will need extra logic to uncheck previous button.
I've have a SingleSelectToggleGroup which contains two toggle buttons. On touching the selected item again, it gets unselected, but the OnCheckedChangeListener is not called?
It get called called when selected for the first time or when I toggle selection but not when unselecting a selected item
I need it to be called for my requirements or even simply disable unsecting when touched again (allow toggle select other buttons)
I hope understood my issue. Please reply