Fix crash when switching app

This commit is contained in:
Jules Aguillon 2022-01-20 21:22:09 +01:00
parent 38adf7d7b9
commit 100e0b270d

View File

@ -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)
{