How to remove RadioButtons From RadioGroup that created Dynamically
i m new in Android and making a app. I need to remove RadioButtons from RadioGroup that is created by String of Array.
What i need is to remove RadioButtons From RadioGroup and and Add new Radiobuttons. i m able to add new Radiobuttons but not able to remove old RadioButtons
for reference here is my code
RelativeLayout layout = (RelativeLayout) findViewById(R.id.layout);
radioGroup = new RadioGroup(this);
final RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.FILL_PARENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
if(count==1){
for(int i =0; i<ans2.length;i++)
{
RadioButton radioButtonView = new RadioButton(this);
radioButtonView.setText(ans2);
radioGroup.addView(radioButtonView, p);
}
}
else
{
radioGroup.setVisibility(View.GONE);
}
}
Any suggestion will be helpful
thanks
i m new in Android and making a app. I need to remove RadioButtons from RadioGroup that is created by String of Array.
What i need is to remove RadioButtons From RadioGroup and and Add new Radiobuttons. i m able to add new Radiobuttons but not able to remove old RadioButtons
for reference here is my code
RelativeLayout layout = (RelativeLayout) findViewById(R.id.layout);
radioGroup = new RadioGroup(this);
final RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.FILL_PARENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
if(count==1){
for(int i =0; i<ans2.length;i++)
{
RadioButton radioButtonView = new RadioButton(this);
radioButtonView.setText(ans2);
radioGroup.addView(radioButtonView, p);
}
}
else
{
radioGroup.setVisibility(View.GONE);
}
}
Any suggestion will be helpful
thanks