Fix demo app crash when media pipe isn't loaded

The toast message about media pipe not loading needs to be shown on the main
(UI) thread.

PiperOrigin-RevId: 449199285
This commit is contained in:
andrewlewis 2022-05-17 13:59:02 +01:00 committed by Ian Baker
parent 9345c1addc
commit 66b3527a22

View File

@ -266,7 +266,7 @@ public final class TransformerActivity extends AppCompatActivity {
/* inputStreamName= */ "input_video",
/* outputStreamName= */ "output_video");
} catch (Exception e) {
showToast(R.string.no_media_pipe_error);
runOnUiThread(() -> showToast(R.string.no_media_pipe_error));
throw new RuntimeException("Failed to load MediaPipe processor", e);
}
});