Search code examples
javaandroidtogglebutton

how to allow only 1 android toggle button out of 3 to be on at once


i am using 3 toggle buttons. In my android application i would like that only 1 of these toggle buttons can be selected at once. How would i go about doing this?


Solution

  • You could use radio buttons. If you don't want that, check out this link - it shows you how to listen for changes to the button state. If you find that one of your buttons is changed, change the other 2 to the off state.