I wrote this code in Canvas constructor and create the object from canvas class in snapper class
it throw NullPointerException...
I dont know what is the problem .....can you help me ??
sorry for bother ...thanks alot for your help
=====================================================================
public class CameraCanvas
extends Canvas {
private SnapperMIDlet mSnapperMIDlet;
private Player p;
public VideoControl videoControl ;
public RecordControl rc;
private OutputStream baos;
public CameraCanvas()
{
try {
p = Manager.createPlayer("capture://video");
p.realize();
rc = (RecordControl) p.getControl("RecordControl");
videoControl = (VideoControl) (p.getControl("VideoControl"));
videoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, this);
videoControl.setVisible(true);
int x = (getWidth() - videoControl.getDisplayWidth()) >> 1;
int y = (getHeight() - videoControl.getDisplayHeight()) >> 1;
videoControl.setDisplayLocation(x, y);
rc.setRecordStream(baos);
p.prefetch();
rc.startRecord();
p.start();
} catch (IOException ex) {
ex.printStackTrace();
} catch (MediaException ex) {
ex.printStackTrace();
}