public void stopCamera() { if (camera != null) { preview.stopCameraPreview(); preview.setCamera(null, null); camera.release(); camera = null; } }
@Override public void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i2, int i3) { if (surfaceHolder.getSurface() == null) { return; } stopCameraPreview(); showCameraPreview(); }
@Override public void surfaceDestroyed(SurfaceHolder surfaceHolder) { mSurfaceCreated = false; stopCameraPreview(); }