Java Reference
In-Depth Information
Listing 16-6. Capturing Images Using Your Camera Phone
import java.io.*;
import javax.microedition.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
import javax.microedition.media.*;
import javax.microedition.media.control.*;
public class CameraMIDlet
extends MIDlet
implements CommandListener, Runnable {
private Display mDisplay;
private Form mMainScreen;
private Item mVideoItem;
private VideoControl mVidc;
private Command mCaptureCommand;
Image mQMarkImg = null;
private ImageItem mCapturedImgItem = null;
private Player mPlayer = null;
private boolean mEndNow = false;
public void startApp() {
mDisplay = Display.getDisplay(this);
if (mQMarkImg == null) {
try {
mQMarkImg = Image.createImage("/qmark.png");
} catch (Exception ex) {
showException(ex);
}
}
if (mMainScreen == null) {
mMainScreen = new Form("Camera MIDlet");
mMainScreen.addCommand(new Command("Exit", Command.EXIT, 0));
mCaptureCommand = new Command("Capture", Command.SCREEN, 0);
mMainScreen.addCommand(mCaptureCommand);
mMainScreen.setCommandListener(this);
}
mDisplay.setCurrent(mMainScreen);
Thread t = new Thread(this);
t.start();
mEndNow = false;
}
public void pauseApp() {}
Search WWH ::




Custom Search