I am trying to set up and Exclusive choicegroup that i can use to determine which form the user will proceed to next. However, when I make the commandAction function it does not recognize the choicegroup that I declared. I don't think I'm supposed to instantiate the group again inside the commandAction, but right now that's the only way I can get it to compile. Here is some of my code...
public void commandAction(Command c, Item item){
ChoiceGroup cgIncidentType = new ChoiceGroup("Category", Choice.EXCLUSIVE);
if(c==exitCommand)
{
exitRequested();
destroyApp(true);
notifyDestroyed();
}
if(c == Next1){
if(item == cgIncidentType)
{
if(cgIncidentType.getSelectedIndex()==5)
{//go to last menu option (gang)
javax.microedition.lcdui.Display.getDisplay(this).setCurrent(SubGangID);
flag1="6";
} else if(cgIncidentType.getSelectedIndex()==4) {//go to suspicious activity page
javax.microedition.lcdui.Display.getDisplay(this).setCurrent(SubSuspActivity);
flag1="5";
}
}
}
}
Right now the program doesn't do anything when I click the next button which is added to my choicegroup. Does anyone see a problem with my command setup????

Reply With Quote

