I have tried this code..It will display three radio buttons in a single row when the emulator starts. But I need a button event for this. i.e; if I click the button, it shou
Try something like below:
RadioGroup rgp= (RadioGroup) findViewById(R.id.radiogroup);
RadioGroup.LayoutParams rprms;
for(int i=0;i<3;i++){
RadioButton radioButton = new RadioButton(this);
radioButton.setText("new"+i);
radioButton.setId(View.generateViewId());
rprms= new RadioGroup.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
rgp.addView(radioButton, rprms);
}