Hi
I've made this midlet and it won't exit when I press the exit button.. the only way i can stop it is by pressing the on/off switch or the end call button. I don't have a clue why its not letting me exit so could anyone have a look at my code and tell me what's wrong? it's probably glaringly obvious....
Code:package GPSreader; import javax.microedition.midlet.*; import javax.microedition.lcdui.*; import java.io.*; public class WebMap extends MIDlet implements CommandListener{ Alert alert; public String position1; public String position2; private Display display ; public DataHandler dh; private Form form = new Form("Form for Stuff"); static final Command exitCommand = new Command("Exit", Command.STOP, 2); public void startApp() throws MIDletStateChangeException{ boolean b; try{ display = Display.getDisplay(this); display.setCurrent(form); form.addCommand(exitCommand); form.setCommandListener(this); form.append("position 1:"); position1 = dh.getLat(); form.append(position1); } catch(Exception e){ System.out.println("error:"+e.toString()); } } public void pauseApp() { } public void destroyApp(boolean unconditional) { destroyApp(true); notifyDestroyed(); } public void commandAction(Command choice, Displayable displayable ) { String label = choice.getLabel(); if (label.equals("Exit")) { destroyApp(true); notifyDestroyed(); } } }

Reply With Quote


