0
votes

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??

1
Do you mean you want to get the string "whatever" in this example?ZelluX

1 Answers

0
votes
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]);
    }