Help with choicegroups in J2ME
Hi, I'm new here, I have this project from my school where I have to send information from cellphone to cellphone, the one who sends the information has to fill some spaces including a choicegroup, but the thing is, that if the first option is chosen, the textbox next to it, it's uneditable, but with the other options, the textbox can be written, in the code I wrote, when I compile it, it doesn't have any error, but when I run the code, instead of execute the options, the textbox is always uneditable, and I don't know what's going on, please, someone help, this is the code:
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
public class ResulDemo
extends MIDlet
implements CommandListener, ItemCommandListener{
private final static String[] TypeCas = {
"B-Basic", "A-Aside", "E-Extraordinary", "S-Special" };
int dx;
private ChoiceGroup types;
private StringItem item;
private Display display;
private Form mainForm;
private final static Command CMD_GO = new Command("Go", Command.ITEM, 1);
private final static Command CMD_PRESS = new Command("Press", Command.ITEM, 1);
private final static Command CMD_EXIT = new Command("Exit", Command.EXIT, 1);
protected void startApp() {
display = Display.getDisplay(this);
mainForm = new Form("Results");
mainForm.append(new TextField("Sectin", "", 4, TextField.NUMERIC));
ChoiceGroup types = new ChoiceGroup("Type:", ChoiceGroup.POPUP,TypeCas, null);
mainForm.append(types);
dx = types.getSelectedIndex();
StringItem item = new StringItem("",null);
mainForm.append(item);
if (TypeCas[dx]==TypeCas[0]){
mainForm.append(new TextField("Type","",2,TextField.UNEDITABLE));
item = new StringItem("Next","",Item.BUTTON);
item.setDefaultCommand(CMD_PRESS);
item.setItemCommandListener(this);
mainForm.append(item);
}else {
mainForm.append(new TextField("Type","",2,TextField.NUMERIC));
item = new StringItem("Next","",Item.BUTTON);
item.setDefaultCommand(CMD_PRESS);
item.setItemCommandListener(this);
mainForm.append(item);
}
mainForm.addCommand(CMD_EXIT);
mainForm.setCommandListener(this);
display.setCurrent(mainForm);
}
public void commandAction(Command c, Item item) {
System.out.println("Continue....");
}
public void commandAction(Command c, Displayable d) {
destroyApp(false);
notifyDestroyed();
}
protected void destroyApp(boolean unconditional) {
}
protected void pauseApp() {
}
}
Please, someone help me, I can't continue with the code if I can't make the choicegroup work...

