예제 #1
0
  @Override
  public void surfaceDestroyed(SurfaceHolder holder) {
    // Surface will be destroyed when we return, so stop the preview.
    // Because the CameraDevice object is not a shared resource, it's very
    // important to release it when the activity is paused.

    if (camera != null) {

      camera.setPreviewCallback(null);
      camera.stopPreview();

      camera.release();
      camera = null;
    }

    if (listener != null) listener.cameraPreviewStopped();
  }