1

I have interesting problem. In the Fragments after inputing text in EditText field i catching next Exception:

java.lang.NullPointerException: Attempt to invoke interface method 'void android.view.inputmethod.InputConnection.closeConnection()' on a null object reference
        at android.view.inputmethod.InputConnectionWrapper.closeConnection(InputConnectionWrapper.java:270)
        at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:541)
        at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:85)
        at android.os.Handler.dispatchMessage(Handler.java:105)
        at android.os.Looper.loop(Looper.java:251)
        at android.app.ActivityThread.main(ActivityThread.java:6572)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

And only after fragment is destroy. And this case appears in all fragments that has EditText. I think there is some problems with InputMethodManager but how to solve it - don't know. Notably, the problem does not appear on all devices. If anyone know, what happens and how to solve this - please, tell me) Thanks.

Scrobot
  • 1,911
  • 3
  • 19
  • 36
  • We can't tell you what is wrong with your code if you don't show us your code. Try to create a [mcve]. – takendarkk May 10 '18 at 11:27
  • I can not show my code, because problem not in one place. In Fragment with some logic, in empty Fragment without any logic. It's everywhere) – Scrobot May 10 '18 at 11:29
  • 2
    In my case the problem was resolved after I turned **off** instant run and executed a clean build. – azizbekian May 10 '18 at 11:30

2 Answers2

2

Go to Run -> Edit configuration settings -> Profiling -> Enable advanced profiling this will prevent EditText from crashing.

Same problem : Null Pointer Exception in InputConnection.finishComposingText() method

Ghulam Moinul Quadir
  • 1,638
  • 1
  • 12
  • 17
1

You know what? I tried to solve this problem about 4 hours. And problem was in Sony Experia Keyboard... I just install Google Keyboard from Google play.. Impossible..

Scrobot
  • 1,911
  • 3
  • 19
  • 36