diff --git a/Android/app/src/main/java/com/cns/encom/MainActivity.java b/Android/app/src/main/java/com/cns/encom/MainActivity.java index d565b83..fdf3770 100644 --- a/Android/app/src/main/java/com/cns/encom/MainActivity.java +++ b/Android/app/src/main/java/com/cns/encom/MainActivity.java @@ -301,7 +301,6 @@ public void run() { } }); - DataOutputStream out; try{ out = new DataOutputStream(socket.getOutputStream()); @@ -341,10 +340,15 @@ public void run() { catch(InterruptedException e){break;} } - mSurfaceHolder.setFormat(PixelFormat.TRANSPARENT); - mSurfaceHolder.setFormat(PixelFormat.OPAQUE); - cameraCheckbox = findViewById(R.id.checkBox); - cameraCheckbox.setChecked(false); + runOnUiThread(new Runnable() { + @Override + public void run() { + mSurfaceHolder.setFormat(PixelFormat.TRANSPARENT); + mSurfaceHolder.setFormat(PixelFormat.OPAQUE); + CheckBox cameraCheckbox = findViewById(R.id.checkBox); + cameraCheckbox.setChecked(false); + } + }); } int getRandomNumber(int min, int max){