From b3b892301458750afd7b41f51a3e7b9495a1c813 Mon Sep 17 00:00:00 2001 From: Alex Dochioiu Date: Wed, 11 Oct 2023 10:45:10 +0300 Subject: [PATCH] imm crash fix --- .../webview/in_app_webview/InAppWebView.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/webview/in_app_webview/InAppWebView.java b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/webview/in_app_webview/InAppWebView.java index 376452eb..e4c2d16f 100755 --- a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/webview/in_app_webview/InAppWebView.java +++ b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/webview/in_app_webview/InAppWebView.java @@ -1525,7 +1525,14 @@ final public class InAppWebView extends InputAwareWebView implements InAppWebVie public void run() { InputMethodManager imm = (InputMethodManager) getContext().getSystemService(INPUT_METHOD_SERVICE); - if (containerView != null && imm != null && !imm.isAcceptingText()) { + boolean isAcceptingText = false; + try { + if (imm != null) { + isAcceptingText = imm.isAcceptingText(); + } + } catch (Exception ignored) { + } + if (containerView != null && imm != null && !isAcceptingText) { imm.hideSoftInputFromWindow( containerView.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); }