1. lse123's Avatar
    I want to dynamically create radios in a radio group... well nothing appear on screen, where error? is in this code exist bug? no is correct / yes at...
    Code:
            RadioGroup radiogroup = (RadioGroup) findViewById(R.id.radio_g); 
            List<String[]> names = DataManipulator.selectAll();
    
            String label;
            for (String[] name : names) {
               //sb.append(name[0]+" - "+name[1]+ "\n"+name[2]+" - "+name[3]+ "\n");
               label=name[1]+ " - "+name[2]+"\n"+name[3]+ " - "+name[4];
               RadioButton newRadioButton = new RadioButton(this); 
    
               newRadioButton.setText(label); 
               newRadioButton.setId(Integer.parseInt(name[0])); 
               radiogroup.addView(newRadioButton, layoutParams);
            }
    
    
    <?xml version="1.0" encoding="UTF-8"?>
    <ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="fill_parent"
    android:layout_width="fill_parent"
    android:padding="15dip" 
    android:orientation="vertical">
    <RadioGroup
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:orientation="vertical"
          android:id="@+id/radio_g"
          >
    
          
    </RadioGroup>
    </ScrollView>
    12-24-2010 10:14 AM
LINK TO POST COPIED TO CLIPBOARD