Hi robz218,
If the MIDlet is closed by the platform the MIDlets destroyApp() method is called with the argument true and the MIDlet will be destroyed. You don't have to call notifyDestroyed() method after that.
If you want close the MIDlet yourself by pressing the exit button, then call the notifydestroyed() method. When notifyDestroyed is called it notifies the AMS(Aplication Management Software) that the midlet has entered Destroyed state and all the resources held my the MIDlet are reclaimed.
Below is a link to implementing MIDlet lifecycle requirements and more about destroyApp() and notyfyDestroyed().
http://library.developer.nokia.com/i...BA1B1ABC3.html
For example...
Code:
public class gameMidlet extends MIDlet implements CommandListener{
public gameCanvas canvas;
public Display display;
public static MIDlet instance;
public gameMidlet() {
canvas = new gameCanvas();
instance = this;
}
public void destroyApp(boolean unconditional) {
//notifyDestroyed();
}
protected void pauseApp() {
// TODO Auto-generated method stub
}
protected void startApp() throws MIDletStateChangeException {
display = Display.getDisplay(this);
canvas.start();
display.setCurrent(canvas);
}
/*
public void quitApp(){
instance.destroyApp(true); -----> error
instance.notifyDestroyed();
instance=null;
System.gc();
}*/
public void commandAction(Command arg0, Displayable arg1) {
// TODO Auto-generated method stub
}
}
And then from your gameCanvas class call
Code:
public void exit()
{
gameMidlet.instance.notifyDestroyed();
}
-tiviinik