I am creating an attendance list of student at run time from database and wants to create dynamically radio buttons in groups against each student and then take their attendance values on a submit button: my code looks like
Ll = new LinearLayout(this);
rg = new RadioGroup(this); //create the RadioGroup
rg.setOrientation(RadioGroup.HORIZONTAL);//or RadioGroup.VERTICAL
RadioButton rb1 = new RadioButton(this);
rb1.setText("P");
rb1.setId(id);
rg.addView(rb1); //the RadioButtons are added to the radioGroup instead of the layout
///////////////////////////////////////////////
RadioButton rb2 = new RadioButton(this);
rb2.setText("A");
rb2.setId(id+1);
rg.addView(rb2); //the RadioButtons are added to the radioGroup instead of the layout
/////////////////////////////////////
RadioButton rb3 = new RadioButton(this);
rb3.setText("L");
rb3.setId(id+2);
rg.addView(rb3); //the RadioButtons are added to the radioGroup instead of the layout
Ll.addView(rg);//you add the whole RadioGroup to the layout
tr.addView((View)Ll); // A
how can i get values from dynamically created radion groups in my Android activity