Search code examples
androidradio-buttonradio-groupandroid-radiogroup

Android: Check radio button by its position in the radio group


I got the position of a radio in a radio group by using indexOfChild. How can I use this index to check the radio that has this particular index?


Solution

  • Try this

    radioGroup.check(((RadioButton)radioGroup.getChildAt(index)).getId())