For my particular application, I want to be able to toggle a radiobutton on and off by touching it, similar to a checkbox. However, I need the radiobuttons to be mutually exclusive within their groups. There are 64 buttons and 8 groups, so I don’t want to use checkboxes and program the toggle functionality manually. Can I use an onTouchListener() with a radiobutton? Is there any way to accomplish this?
Thank you in advance for any support.
For my particular application, I want to be able to toggle a radiobutton on
Share
You are looking for a UI paradigm that is neither a checkbox nor a radio button. Your best bet is to use check boxes and then implement the mutual exclusivity on top of that. e.g.,
Note that if you are able to enumerate all of the button IDs per group, you can write the code generically, like,
The other, more complicated answer would be to build your own UI widget and give it whatever semantics you want. That’s not scope of what I could describe here though.