From 41ca5809b111c552d7f5b9adc0c5745fe6459085 Mon Sep 17 00:00:00 2001 From: Vladimir Kotikov Date: Wed, 8 Jun 2016 18:04:03 +0300 Subject: [PATCH] CB-11326 Prevent crash when initializing plugin after navigating to another URL --- src/android/SplashScreen.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/android/SplashScreen.java b/src/android/SplashScreen.java index 7f5cedc..14b6379 100644 --- a/src/android/SplashScreen.java +++ b/src/android/SplashScreen.java @@ -83,7 +83,13 @@ public class SplashScreen extends CordovaPlugin { return; } // Make WebView invisible while loading URL - getView().setVisibility(View.INVISIBLE); + // CB-11326 Ensure we're calling this on UI thread + cordova.getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + getView().setVisibility(View.INVISIBLE); + } + }); int drawableId = preferences.getInteger("SplashDrawableId", 0); if (drawableId == 0) { String splashResource = preferences.getString("SplashScreen", "screen");