Skip to content

Instantly share code, notes, and snippets.

@pedrogk
Created September 25, 2016 00:15
Show Gist options
  • Save pedrogk/590c125f02da48dc115055a7f209658f to your computer and use it in GitHub Desktop.
Save pedrogk/590c125f02da48dc115055a7f209658f to your computer and use it in GitHub Desktop.
import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.TextBox;
public class HolaMidlet extends MIDlet implements CommandListener {
private Display display;
private Command cmdExit;
private TextBox tbxMain;
// constructor
public HolaMidlet () {
display = Display.getDisplay(this);
cmdExit = new Command(“Exit”,
Command.EXIT, 1);
tbxMain = new TextBox( “HelloMidlet”, “Hola mundo movil”, 50, 0);
tbxMain.addCommand(cmdExit);
tbxMain.setCommandListener(this);
}
public void startApp() {
display.setCurrent(tbxMain);
}
public void pauseApp(){}
public void destroyApp(boolean unconditional){}
public void commandAction(Command c, Displayable s) {
if (c == cmdExit) {
destroyApp(false);
notifyDestroyed();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment