Java Reference
In-Depth Information
public class VideoMIDlet
extends MIDlet
implements CommandListener, Runnable {
private Display mDisplay;
private Form mMainScreen;
private Item mVideoItem;
private VideoControl mVidc;
private Command mPlayCommand;
private Player mPlayer = null;
public void startApp() {
mDisplay = Display.getDisplay(this);
if (mMainScreen == null) {
mMainScreen = new Form("Video MIDlet");
mMainScreen.addCommand(new Command("Exit", Command.EXIT, 0));
mPlayCommand = new Command("Play", Command.SCREEN, 0);
mMainScreen.addCommand(mPlayCommand);
mMainScreen.setCommandListener(this);
}
mDisplay.setCurrent(mMainScreen);
}
public void pauseApp() {}
public void destroyApp(boolean unconditional) {
if (mPlayer != null) {
mPlayer.close();
}
}
public void commandAction(Command c, Displayable s) {
if (c.getCommandType() == Command.EXIT) {
destroyApp(true);
notifyDestroyed();
}
else {
Form waitForm = new Form("Loading...");
mDisplay.setCurrent(waitForm);
Thread t = new Thread(this);
t.start();
}
}
Search WWH ::




Custom Search