From 400ade252fc8252ada2b5c47556e511bfd977425 Mon Sep 17 00:00:00 2001 From: shtolik Date: Fri, 25 Aug 2017 11:09:45 +0300 Subject: [PATCH] Fix updating layout from wrong thread (#1) --- .../main/java/com/otaliastudios/cameraview/CameraView.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java index 2c75c9d3..8450ce9a 100644 --- a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java @@ -1215,7 +1215,12 @@ public class CameraView extends FrameLayout { // Request a layout pass for onMeasure() to do its stuff. // Potentially this will change CameraView size, which changes Surface size, // which triggers a new Preview size. But hopefully it will converge. - requestLayout(); + uiHandler.post(new Runnable() { + @Override + public void run() { + requestLayout(); + } + }); }