newbie: problems destroying midlet

J

Jeff

Hey

J2ME Wireless Toolkit 2.2
JDK 5

My midlet below, doesn't exit when hitting the exit key, I'm not sure what
I'm doing wrong here... I've spent hours investigate the problem, but I
cannot see why it can't exit when pushing the exit key (exit key = the
right soft key.... I guess it's standard that the right soft key is the exit
button)

package com.test;

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class chemistry extends MIDlet implements CommandListener
{
private static Display display;
private Command exitCommand = new Command("Exit", Command.EXIT, 99);
private Form form;
private StringItem lblWelcome;
private StringItem lblInfo;

public chemistry()
{
form = new Form("Chemistry");
//Add GUI elements:
lblInfo = new StringItem("Please make a selection", null);
lblInfo.setLayout(Item.LAYOUT_CENTER);

//Add commands
form.addCommand(exitCommand);
}

public void startApp()
{
Display display = Display.getDisplay(this);
display.setCurrent(form);
}

public void pauseApp()
{
}

public void destroyApp(boolean unconditional)
{

}

public void commandAction(Command c, Displayable s) {
if (c == exitCommand) {
try
{
destroyApp(false);
notifyDestroyed();
}
catch (Exception ex)
{
}
}
}
}

I would be very thankful if someone could give me some tips about what I'm
doing wrong here....

Jeff
 
R

Roedy Green

I would be very thankful if someone could give me some tips about what I'm
doing wrong here....

have you put any code in your action handler to see what is coming
through? Maybe the exit does not look exactly like that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top