开发者

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜