Skip to content

Commit 5a11ba8

Browse files
author
luowei
committed
Fixing RuntimeException when calling CameraView.stop() google#158
1 parent d020616 commit 5a11ba8

File tree

1 file changed

+5
-2
lines changed
  • library/src/main/api14/com/google/android/cameraview

1 file changed

+5
-2
lines changed

library/src/main/api14/com/google/android/cameraview/Camera1.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,11 @@ void takePictureInternal() {
243243
public void onPictureTaken(byte[] data, Camera camera) {
244244
isPictureCaptureInProgress.set(false);
245245
mCallback.onPictureTaken(data);
246-
camera.cancelAutoFocus();
247-
camera.startPreview();
246+
//Check if camera still previewing
247+
if (mShowingPreview) {
248+
camera.cancelAutoFocus();
249+
camera.startPreview();
250+
}
248251
}
249252
});
250253
}

0 commit comments

Comments
 (0)