[求助]关于拍照的问题
我开了一个线程来单独执行拍照,代码如下,videoControl在showCamera()方法里面是有值的,但是在capture()方法里面却变成了null,请问是怎么回事啊?请高手指点啊``
public void showCamera(Canvas canvas) {
try {
player = Manager.createPlayer( "capture://video ");
player.realize();
videoControl = (VideoControl)player.getControl( "VideoControl ");
if (videoControl != null) {
videoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, canvas);
videoControl.setVisible(true);
}
player.start();
}
catch (Exception e) {
e.printStackTrace();
}
}
public void capture() {
new Thread() {
public void run() {
try {
byte[] raw = videoControl.getSnapshot(null);
}
catch (Exception e) {
e.printStackTrace();
}
}
}.start();
}
------解决方案--------------------^_^。
那我来接分。嘿嘿。