2011-10-19 2 views

답변

3

이 코드는 자체 instanceof를의

int count = radioGroup.getChildCount(); 
    for (int i = 0; i < count; i++) { 
     View o = radioGroup.getChildAt(i); 
     if (o instanceof RadioButton) { 

      RadioButton radioBtn = (RadioButton)o; 
      // get the state 
      boolean isChecked = radioBtn.isChecked() 
      // to set the check 
      radioBtn.setChecked(true); 

     } 
    } 
+2

한 좋은 사용을 설명 생각 (그들은 자신에, 같은 그룹에있는 경우 다른 사람이 취소됩니다) ID로 설정하십시오 – MKJParekh

2

각 버튼마다 고유 한 ID가 있습니다. 당신은

관련 문제