Hi,
I have an array of CheckboxField[] elements that I need to dynamically initialize. My sample code is -
class abc extends MainScreen implements FieldChangeListener {
CheckboxField[] boxField;
abc() {
.
.
.
boxField = new CheckboxField[length];
VerticalFieldManager vfm = new VerticalFieldManager();
for(int i=0; i<length; i++) {
boxField[i] = new CheckboxField(var[i], false);
boxField[i].setChangeListener(this);
vfm.add(boxField[i]);
}
add(vfm);
}
public void fieldChanged(Field field, int context) {
// The idea is to disable all the other checkboxes when one
// is clicked.
boxField[0].setChecked(false); // Gives stackoverflow error on JVM.
}
}
Any help?
Edit: The problem only seems to be with .setChecked(boolean) I've tried chkboxField[0].setFont(), chkboxField.getChecked(), both of them seem to work.