Hello,
I'm starting in Java ME development, but when i finished the code, that i'm developing using Eclipse, it shows that my code have an error, with that red x in the left of the code line, here is the code:
package comm;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Form;
public class comm extends MIDlet implements CommandListener {
private Display display;
private Form inicio;
private Form logado;
private Form recusado;
private Command cancelar;
private Command login;
private Command info;
private Command help;
private Command naousuario;
private Command voltar;
public comm() {
inicio = new Form("Entrar");
cancelar = new Command("Cancelar", Command.CANCEL, 0);
login = new Command("Login", Command.OK, 1);
info = new Command("Info", Command.OK, 1);
help = new Command("Help", Command.OK, 1);
inicio = new Form("Logado");
recusado = new Form("Não Usuário");
logado = new Form("Logado");
naousuario = new Command("Não Usuário", Command.OK, 1);
voltar = new Command("Voltar", Command.BACK, 0);
}
protected void destroyApp(boolean unconditional) throws MIDletStateChangeException {
notifyDestroyed();
}
protected void pauseApp() {
// TODO Auto-generated method stub
}
protected void startApp() throws MIDletStateChangeException {
// Form Inicial
display = Display.getDisplay(this);
inicio.addCommand(cancelar);
inicio.addCommand(login);
inicio.addCommand(info);
inicio.addCommand(help);
inicio.addCommand(naousuario);
inicio.setCommandListener(this);
// Form Usuário Logado
logado.addCommand(info);
logado.addCommand(voltar);
logado.setCommandListener(this);
// Form Não Usuário
recusado.addCommand(voltar);
recusado.setCommandListener(this);
display.setCurrent(inicio);
}
public void commandAction(Command c, Displayable d) {
if (c == cancelar) {
destroyApp(true);
} else if (c == login) {
display.setCurrent(logado);
} else if (c == naousuario) {
display.setCurrent(recusado);
} else if (c == voltar) {
display.setCurrent(inicio);
}
}
}
The error is in the line 67, and the error detail that is in the Problems tab is here:
Unhandled exception type MIDletStateChangeException
What is wrong?
Thanks,
Nathan Paulino Campos