From 100e0b270db0a99670526d646347085f0f79f418 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Thu, 20 Jan 2022 21:22:09 +0100 Subject: [PATCH] Fix crash when switching app --- srcs/juloo.keyboard2/Keyboard2.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/srcs/juloo.keyboard2/Keyboard2.java b/srcs/juloo.keyboard2/Keyboard2.java index b3772ae..fdaa672 100644 --- a/srcs/juloo.keyboard2/Keyboard2.java +++ b/srcs/juloo.keyboard2/Keyboard2.java @@ -20,6 +20,7 @@ import android.view.ContextThemeWrapper; import android.view.KeyEvent; import android.view.View; import android.view.ViewGroup; +import android.view.ViewParent; import android.util.Log; import java.util.HashMap; import java.util.List; @@ -188,6 +189,15 @@ public class Keyboard2 extends InputMethodService setInputView(_keyboardView); } + @Override + public void setInputView(View v) + { + ViewParent parent = v.getParent(); + if (parent != null && parent instanceof ViewGroup) + ((ViewGroup)parent).removeView(v); + super.setInputView(v); + } + @Override public void onCurrentInputMethodSubtypeChanged(InputMethodSubtype subtype) {