public class MCQSample extends Activity implements OnClickListener{
TextView title;
String gotBread;
RadioGroup AnswerRG;
int value ;
int value1;
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.mcqsample);
title = (TextView) findViewById(R.id.abc);
nextP = (Button) findViewById(R.id.nextP);
backP = (Button) findViewById(R.id.backP);
AnswerRG = (RadioGroup) findViewById(R.id.AnswerRG);
Bundle b = getIntent().getExtras();
value = b.getInt("key", 0);
}
}
Hi guys, im doing the Android app and stuck on create the dynamic radio-button. Because i don’t know how many button i need (which depend on the value – user input). I read some posts which can add on the Layout but i want to add into the radioGroup. Is there any ways? Thank
Step #1: Create a new
RadioButtonvia its constructor and configure it as you see fit.Step #2: Call
addView()on yourRadioGroupto add theRadioButtonto it.Step #3: There is no step #3