how to get the text of a radiobutton created dynamically?
Hi i have created a radioGroup and dynamically added radiobuttons...
Radiogroup= (RadioGroup) findViewById(R.id.Radiogroup);
for (int i=0; i<3 i++){
Radiob = new RadioButton(Radiogroup.this);
Radiob.setText("whatever");
Radiob.setId(i);
开发者_如何学编程 Radiogroup.addView(Radiob);
}
The thing is how can i get the text of these Radiobuttons??
String[] textRadios = new String[3];
for (int i=0; i<3 i++){
Radiob = new RadioButton(Radiogroup.this);
textRadios[i]=Radiob.getText().toString();
Log.i("RadioButton: "+i, textRadios[i]);
}
精彩评论