2012-01-18 17 views
0
rGroup = (RadioGroup)findViewById(R.id.radioGroup); 
    rGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() { 

     public void onCheckedChanged(RadioGroup group, int checkedId) { 
      Toast.makeText(cont, checkedId, Toast.LENGTH_SHORT).show(); 
     } 
    }); 

將數據放入這些代碼上面,我試圖讓用戶點擊單選組什麼,需要幫助的獲取和從RadioGroup中

我不應使用onClicklistener吧?

+0

你可以在這裏你的答案 http://stackoverflow.com/questions/8815129/radio-buttons-showing-only-first-option-correct-and-the-others-showing-all-wrong/8815310 #8815310 希望它適合你.. :-) – 2012-01-18 14:23:02

回答

0

您將checkedId作爲參數。這是選中的單選按鈕的ID。您可以將此值傳遞給findById以獲取RadioButton對象。