From 3b04f6566d70905f411eefa508f782183bb48e5f Mon Sep 17 00:00:00 2001 From: Sarafanov Valeriy Date: Wed, 22 Jan 2020 17:02:58 +0300 Subject: [PATCH] Android GH-470 InAppBrowser: java.lang.IllegalArgumentException Fix interacting with views when Activity destroyed Bug description https://stackoverflow.com/questions/22924825/view-not-attached-to-window-manager-crash --- src/android/InAppBrowser.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java index 84144389f..efec7eccf 100644 --- a/src/android/InAppBrowser.java +++ b/src/android/InAppBrowser.java @@ -313,7 +313,7 @@ else if (action.equals("show")) { this.cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { - if (dialog != null) { + if (dialog != null && !cordova.getActivity().isFinishing()) { dialog.show(); } } @@ -326,7 +326,7 @@ else if (action.equals("hide")) { this.cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { - if (dialog != null) { + if (dialog != null && !cordova.getActivity().isFinishing()) { dialog.hide(); } } @@ -537,7 +537,7 @@ public void run() { childView.setWebViewClient(new WebViewClient() { // NB: wait for about:blank before dismissing public void onPageFinished(WebView view, String url) { - if (dialog != null) { + if (dialog != null && !cordova.getActivity().isFinishing()) { dialog.dismiss(); dialog = null; }