Java ME Developer Guide

Chapter 22 - Network APIs

public class WakeUp extends MIDlet implements CommandListener{

public static Display display; public static Form mainForm; public static Command exitCommand; public static TextField tf;

public static Command registerCommand;

public void startApp() {

display = Display.getDisplay(this);

mainForm = new Form("WakeUp");

exitCommand = new Command("Exit", Command.EXIT, 0); registerCommand = new Command("Register", Command.SCREEN, 0); tf = new TextField("Delay in seconds", "10", 10, TextField.NUMERIC); mainForm.addCommand(exitCommand); mainForm.addCommand(registerCommand); mainForm.append(tf); mainForm.setCommandListener(this);

display.setCurrent(mainForm);

}

public void pauseApp() {

}

public void destroyApp(boolean unconditional) { notifyDestroyed();

}

public void commandAction(Command c, Displayable s) { if((c == exitCommand) && (s == mainForm)){

destroyApp(false);

}

if(c == registerCommand){

new regThread().start();

}

}

DRAFT - Subject to Change [162/201]

Page 162
Image 162
Motorola maxx V6 manual Draft Subject to Change 162/201