×
Namespaces

Variants
Actions
Revision as of 08:25, 5 June 2009 by tanjaluodes (Talk | contribs)

How to display the camera & take snapshots in Java ME

From Nokia Developer Wiki
Jump to: navigation, search


The following code is used for camera display:

public void cameraPlayer() {
try {
player = Manager.createPlayer("capture://video");
player.realize();
 
videoControl = (VideoControl)player.getControl("VideoControl");
player.start();
} catch (Exception e) {}
}


The following code is used for capturing images using camera in Java ME:

byte[] raw = videoControl .getSnapshot(null);
Image image = Image.createImage(raw, 0, raw.length);

TODO: list available modes, and when you need to use a different locator

helpful links:

http://developers.sun.com/techtopics/mobility/midp/articles/picture/ http://www.java-tips.org/java-me-tips/midp/capturing-video-on-j2me-devices.html

330 page views in the last 30 days.