title: app passed NULL surface, while taking a picture without a surfaceview
body: <p>I'm writing an android app. I encounter the following problem:</p>
  
  <p><em><strong>app passed NULL surface</em></strong></p>
  
  <p>while executing the following code:</p>
  
  <pre><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();
                  }
              }  
  
  
  </code></pre>
  
  <p>The main goal is to take a picture without the surfaceview, in order to store it and send via email as quickly as possible.</p>
  
  <p>Thanks in advance.</p>