I made a form to accept the player name then On ok press it will give me an alert and on done click it will take me to a list Start,Credit and Highscore . Please help I am totally new in this field
this is start function where i made my canvas midlet
public void startGame() throws Exception
{
try{
disp = Display.getDisplay(this);
ExampleGameCanvas game=new ExampleGameCanvas();
game.start();
// game.addCommand(back);
// game.addCommand(exit);
game.setCommandListener(this);
disp.setCurrent(game);
} catch(Exception ex) {
}
this the commandAction code where I called my start() function
String lbl=c.getLabel();
if(lbl.equals("OK")&& d==form)
{
printText= new Alert("Welcome! To Road Fighter Game ! :) ",txt.getString(), null , null);
printText.setTimeout(Alert.FOREVER);
printText.addCommand(ok);
printText.setCommandListener(this);
disp.setCurrent(printText);
}else if(lbl.equals("OK") && d==printText)
{
menu();
gameMenu.addCommand(ok);
gameMenu.addCommand(exit);
gameMenu.setCommandListener(this);
// int in=gameMenu.getSelectedIndex();
}else if(lbl.equals("EXIT"))
{
destroyApp(true);
}else if(lbl.equals("BACK"))
{
menu();
gameMenu.addCommand(ok);
gameMenu.addCommand(exit);
gameMenu.setCommandListener(this);
}else
{
try {
List down = (List)disp.getCurrent();
switch(down.getSelectedIndex()) {
case 0:
startGame();
break;
case 1: Credits();break;
}
} catch (Exception ex) {
}
}