Code ...{
private void createRadioButton() {
final RadioButton[] rb = new RadioButton[5];
for(int i=0; i<5; i++){
rb[i] = ne
Your Layout.
code
RadioGroup rg = (RadioGroup) findViewById(R.id.radiogroup);//not this RadioGroup rg = new RadioGroup(this);
rg.setOrientation(RadioGroup.HORIZONTAL);//or RadioGroup.VERTICAL
for(int i=0; i<5; i++)
{
rb[i] = new RadioButton(this);
rg.addView(rb[i]);
rb[i].setText("Test");
}
hope this help you.