rd1 = (RadioButton) findViewById(R.id.rd1);
rd2 = (RadioButton) findViewById(R.id.rd2);
rd3 = (RadioButton) findViewById(R.id.rd3);
rd4 = (RadioButton) findViewById(R.id.rd4);
RadioGroup rg = new RadioGroup(this);
rg.addView(rd1);
rg.addView(rd2);
rg.addView(rd3);
rg.addView(rd4);
rd1.setChecked(true);
The error is : You must call removeview() on the child's parent first.... Some one help me...