Wednesday, January 18, 2012

need help in getting and putting data from RadioGroup



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();
}
});



in these code above, i'm trying to get what the user clicks on the radio group,



i shouldn't use onClicklistener right?

1 comment:

  1. You get checkedId as parameter. This is the the id of the checked radio button. You can pass this value to findViewById to get the RadioButton object.

    ReplyDelete