I'm writing an android app. I encounter the following problem:
app passed NULL surface
while executing the following code:
public void takePictureNoPreview(Context context){
try {
myCamera = Camera.open(0);
} catch (Exception e) {
e.printStackTrace();
console.append("Failed to connect to camera\n");
}
if(myCamera!=null){
SurfaceView dummy=new SurfaceView(context);
try {
myCamera.setPreviewDisplay(dummy.getHolder());
myCamera.startPreview();
myCamera.takePicture(null, null, getJpegCallback());
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally
{
myCamera.stopPreview();
myCamera.release();
}
}
The main goal is to take a picture without the surfaceview, in order to store it and send via email as quickly as possible.
Thanks in advance.