я создал динамическую радиогруппу, в которой каждая группа имеет три радиокнопки, поэтому при проверенном слушателе смены, как я могу получить идентификатор радиокнопки, проверенной в радиогруппе..... заранее спасибо..
public class Rate_me_up extends Activity implements OnClickListener,
OnCheckedChangeListener {
LinearLayout layout;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.rate_me_up);
layout = (LinearLayout) findViewById(R.id.linear);
Button btnp = (Button) findViewById(R.id.buttonp);
btnp.setOnClickListener(this);
}
@Override
public void onClick(View v) {
RadioGroup radioGroup = new RadioGroup(Rate_me_up.this);
radioGroup.setOrientation(1);
LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
layout.addView(radioGroup, p);
RadioButton radioButtonView = new RadioButton(Rate_me_up.this);
radioButtonView.setText("RadioButton");
radioButtonView.setChecked(false);
radioGroup.addView(radioButtonView, p);
RadioButton radioButtonView2 = new RadioButton(Rate_me_up.this);
radioButtonView2.setText("RadioButton2");
radioButtonView2.setChecked(false);
radioGroup.addView(radioButtonView2, p);
RadioButton radioButtonView3 = new RadioButton(Rate_me_up.this);
radioButtonView3.setText("RadioButton2");
radioGroup.addView(radioButtonView3, p);
radioButtonView3.setChecked(false);
radioGroup.setOnCheckedChangeListener(this);
}
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
}
}
RadioButton
поsetId()
. - person Spring Breaker   schedule 29.01.2014checkedId
вonCheckedChanged
вернет вам идентификатор проверенногоRadioButton
. - person Apoorv   schedule 29.01.2014