Skip to content

Commit

Permalink
UI thread bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
teamclouday committed Nov 29, 2020
1 parent f1a2be1 commit 476dc36
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions Android/app/src/main/java/com/cns/encom/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,10 @@ public void run(){
public void run() {
TextView logsWindows = findViewById(R.id.textView);
logsWindows.append("RTSP Server started\n");
CheckBox cameraCheckbox = findViewById(R.id.checkBox);
cameraCheckbox.setChecked(true);
}
});
CheckBox cameraCheckbox = findViewById(R.id.checkBox);
cameraCheckbox.setChecked(true);

DataOutputStream out;
try{
Expand Down Expand Up @@ -340,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){
Expand Down

0 comments on commit 476dc36

Please sign in to comment.