Q:

RadioButtonGroup issue on OS 6

The following piece of code works well in Blackberry OS 4 and 5. But in OS 6 it does not show "Female" radio button option.  Can anyone give reason for this, suggest a solution that work for all Blackberry OS?
LabelField genderLabelField = new LabelField("Gender:");
RadioButtonGroup radioButtonGroup = new RadioButtonGroup();

RadioButtonField maleRadioField = new RadioButtonField("Male");
RadioButtonField femaleRadioField = new RadioButtonField("Female");

private VerticalFieldManager createUI()
{       
    VerticalFieldManager vfmForm = new VerticalFieldManager();

    vfmForm.add(joinf2fLabelField);

    firstNameEditField.setMargin(0, 0, 5, 0);
    vfmForm.add(firstNameLabelField);
    vfmForm.add(firstNameEditField);

    lastNameEditField.setMargin(0, 0, 5, 0);
    vfmForm.add(lastNameLabelField);
    vfmForm.add(lastNameEditField);

    emailEditField.setMargin(0, 0, 5, 0);
    vfmForm.add(emailLabelField);
    vfmForm.add(emailEditField);

    passwordEditField.setMargin(0, 0, 5, 0);
    vfmForm.add(passwordLabelField);
    vfmForm.add(passwordEditField);

    confirmPasswordEditField.setMargin(0, 0, 5, 0);
    vfmForm.add(confirmPasswordLabelField);
    vfmForm.add(confirmPasswordEditField);

    vfmForm.add(genderLabelField);

    radioButtonGroup.add(maleRadioField);
    radioButtonGroup.add(femaleRadioField);

    HorizontalFieldManager hfmGender = new HorizontalFieldManager();

    maleRadioField.setMargin(new XYEdges(0, 5, 0, 0));
    hfmGender.add(maleRadioField);
    hfmGender.add(femaleRadioField);

    hfmGender.setMargin(new XYEdges(5, 0, 10, 0));
    vfmForm.add(hfmGender);

    vfmForm.add(dateField);

    HorizontalFieldManager hfmButtons = new   HorizontalFieldManager(FIELD_HCENTER | FIELD_VCENTER);

    hfmButtons.add(submitButton);
    submitButton.setMargin(new XYEdges(0, 10, 0, 0));

    hfmButtons.add(cancelButton);
    hfmButtons.setMargin(new XYEdges(10, 0, 5, 0));

    vfmForm.add(hfmButtons);        

    return vfmForm;
}

A:

I got it working. This is a bug of Blackberry OS 6 that if you have two radio buttons in a HorizontalFieldManager it wouldn't show the second one. You just need to extend the RadioButtonField and use it in place of the original.
class RadioButtonFieldPatch extends RadioButtonField
{
    RadioButtonFieldPatch(String label)
    {
        super(label);
    }

    RadioButtonFieldPatch(String label, RadioButtonGroup group, boolean selected)
    {
        super(label, group, selected);
    }

     protected void layout(int width, int height)
     {
         int pWidth = this.getPreferredWidth();
         setExtent(pWidth, height);
         super.layout(pWidth, height);
     }
}

