From 8b52796a8959aa96ed986ef520e1f94df3650715 Mon Sep 17 00:00:00 2001 From: Joe Bowser Date: Wed, 28 Aug 2013 14:20:01 -0700 Subject: [PATCH] CB-4586: Making loadUrl run on the UI thread for close dialog to stop the WebView error --- src/android/InAppBrowser.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java index a4f6b8b..0dd1094 100644 --- a/src/android/InAppBrowser.java +++ b/src/android/InAppBrowser.java @@ -313,7 +313,17 @@ public class InAppBrowser extends CordovaPlugin { */ private void closeDialog() { try { - this.inAppWebView.loadUrl("about:blank"); + final WebView childView = this.inAppWebView; + Runnable runnable = new Runnable() { + + @Override + public void run() { + childView.loadUrl("about:blank"); + } + + }; + + this.cordova.getActivity().runOnUiThread(runnable); JSONObject obj = new JSONObject(); obj.put("type", EXIT_EVENT);