RadioGroup.check(int) not working
<p>I'm having a little trouble with RadioGroups.
I created a blank radiogroup in layout.
And then filled it with equalizer presets in the code.
Then I tried to set one of the option using radiogroup.check(1).
But it threw a null pointer exception.</p>

<p>Below is the code:</p>

<pre><code>protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.equalizer);
    //rgEqualizer = (RadioGroup) findViewById(R.id.rgEqualizerPreset);
    mPlayer = new MediaPlayer();
    mEqualizer = new Equalizer(0, AuID);
    rgEqualizer = new RadioGroup(this);
    radioButtonList = new ArrayList&lt;RadioButton&gt;();
    layoutParams = new RadioGroup.LayoutParams(
        RadioGroup.LayoutParams.FILL_PARENT,
        RadioGroup.LayoutParams.WRAP_CONTENT);

    fillRadioGroupWithRadioButtons();
    rgEqualizer.setEnabled(true);
    rgEqualizer.setOnCheckedChangeListener(this);
    addContentView(rgEqualizer, layoutParams);
    loadPresetsettings();
}
private void fillRadioGroupWithRadioButtons() {
    Short noPresets = mEqualizer.getNumberOfPresets();
    short i = 0;
    while (i &lt; noPresets) {
        RadioButton rb = new RadioButton(this);
        rb.setText(mEqualizer.getPresetName(i));
        rgEqualizer.addView(rb, layoutParams);
        i++;
    }
}
private void loadPresetsettings() { 
    rgEqualizer.check(1);
}
</code></pre>

<p>It seems like even after adding the child radio buttons fillRadioGroupWithRadioButtons(), there are no childs added in radiogroup.
What am I missing/</p>

<p>Thanks in advance</p>
