I have a RadioGroup view inside a LinearLayout. The radio buttons are
added from dataList. If I call the code below from inside onCreate,
the correct button is checked. However the dataList can get updated
from time to time and after that happens I call this code again,
without destroying the Activity. After that, the view is redrawn but
no button is checked. I suspect the RadioGroup checked-button
bookkeeping is getting confused by the removeAllViews call. Any ideas
what might be going wrong?
RadioGroup group = (RadioGroup) findViewById(
R.id.radioListGroup );
group.removeAllViews();
for( int i = 0 ; i < dataList.getCount() ; i++ ){
RadioButton button = new RadioButton (this);
dataList.moveToPosition(i);
button.setText(dataList.getString(i));
button.setId(i);
group.addView(button);
if( dataList.getChosen() ) {
group.check(i);
}
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en