From d3067e41622ed33064e90cf1ee981711c44c5fba Mon Sep 17 00:00:00 2001 From: KhatibFX Date: Fri, 7 Apr 2023 22:06:05 +0800 Subject: [PATCH] Fixed view hiding not working properly. --- .../in_app_browser/InAppBrowserActivity.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_browser/InAppBrowserActivity.java b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_browser/InAppBrowserActivity.java index 8db250a4..695f72bd 100755 --- a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_browser/InAppBrowserActivity.java +++ b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_browser/InAppBrowserActivity.java @@ -541,8 +541,12 @@ public class InAppBrowserActivity extends AppCompatActivity implements InAppBrow } ViewGroup vg = (ViewGroup) (webView.getParent()); if (vg != null) { - //Modified view removal to try and fix a crash - webView.visibility = View.GONE; + // Modified view removal to try and fix a crash + for (int i = 0; i < vg.getChildCount(); i++) { + View v = vg.getChildAt(i); + v.visibility = View.GONE; + } + // instead of using // vg.removeView(webView); } webView.setWebChromeClient(new WebChromeClient());