カスタム キーボードを作成しましたが、portrait から lanscape に切り替えるたびに、次のエラーが発生してクラッシュします。
2020-07-04 16:31:38.846 24634-24634/com.nisarg.nboard E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.nisarg.nboard, PID: 24634
java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
at android.view.ViewGroup.addViewInner(ViewGroup.java:4939)
at android.view.ViewGroup.addView(ViewGroup.java:4770)
at android.view.ViewGroup.addView(ViewGroup.java:4742)
at android.inputmethodservice.InputMethodService.setInputView(InputMethodService.java:1483)
at android.inputmethodservice.InputMethodService.updateInputViewShown(InputMethodService.java:1325)
at android.inputmethodservice.InputMethodService.showWindowInner(InputMethodService.java:1767)
at android.inputmethodservice.InputMethodService.showWindow(InputMethodService.java:1735)
at android.inputmethodservice.InputMethodService.resetStateForNewConfiguration(InputMethodService.java:1003)
at android.inputmethodservice.InputMethodService.onConfigurationChanged(InputMethodService.java:984)
at android.app.ActivityThread.performConfigurationChanged(ActivityThread.java:4918)
at android.app.ActivityThread.handleConfigurationChanged(ActivityThread.java:5108)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1731)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:6635)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
なぜこのエラーが発生するのかわかりません。誰か助けてください。