I suspect you will need to check whatever RadioButton you want again. Or, rather than getting rid of the buttons and rebuilding them all, just change their captions. Or, switch to a single-selection ListView.
On Thu, Oct 7, 2010 at 2:32 PM, Bret Foreman <[email protected]> wrote: > 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 > -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training...At Your Office: http://commonsware.com/training -- 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

