
Originally Posted by
ijazhasan
I have tried to install .jar files with the most simple codes from Sun java ME codes but the phone says application not compatible... The code is written below:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
// A first MIDlet with simple text and a few commands.
public class FirstMIDlet extends MIDlet
implements CommandListener {
//The exit, info, and buy commands
private Command exitCommand;
private Command infoCommand;
private Command buyCommand;
//The display for this MIDlet
private Display display;
public FirstMIDlet() {
display = Display.getDisplay(this);
exitCommand = new Command("Exit", Command.SCREEN, 1);
infoCommand = new Command("Info",Command.SCREEN, 2);
buyCommand = new Command("Buy", Command.SCREEN, 2);
}
// Start the MIDlet by creating the TextBox and
// associating the exit command and listener.
public void startApp() {
TextBox t = new TextBox("FirstMIDlet",
"Welcome to MIDP Programming", 256, 0);
t.addCommand(exitCommand);
t.addCommand(infoCommand);
t.addCommand(buyCommand);
t.setCommandListener(this);
display.setCurrent(t);
}
// Pause is a no-op because there are no background
// activities or record stores to be closed.
public void pauseApp() { }
// Destroy must cleanup everything not handled
// by the garbage collector.
// In this case there is nothing to cleanup.
public void destroyApp(boolean unconditional) { }
// Respond to commands. Here we are only implementing
// the exit command. In the exit command, cleanup and
// notify that the MIDlet has been destroyed.
public void commandAction(Command c, Displayable s) {
if (c == exitCommand) {
destroyApp(false);
notifyDestroyed();
}
}
}