android - 'void android.view.inputmethod.InputConnection.closeConnection()' 上的 NullPointerException
问题描述
我有一个有趣的问题。在 EditText 字段中输入文本后的片段中,我遇到了下一个异常:
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)
只有在片段被破坏之后。并且这种情况出现在所有具有 EditText 的片段中。我认为有一些问题,InputMethodManager
但如何解决它 - 不知道。值得注意的是,该问题并未出现在所有设备上。如果有人知道,会发生什么以及如何解决这个问题 - 请告诉我)谢谢。
解决方案
转到Run -> Edit configuration settings -> Profiling -> Enable advanced profiling
此将防止EditText
崩溃。
推荐阅读
- symfony - 如何使用datatableBundle和symfony从继承自另一个类的类中获取实例
- php - 如何从 mysql + php 为特定列生成数据
- c# - 错误 CS0103 当前上下文中不存在名称“db”
- oracle - 创建包时 PL/SQL 编译错误
- yii2 - 在视图中包含帮助程序类
- excel - 如何从 Excel VBA 中的 Outlook 共享邮箱中提取已发送的项目?
- r - 如果将代码放入函数中,则用 NA 替换某些向量值不起作用
- xamarin.forms - 使用 Xamarin.Forms (MVVM) 测试命令
- apache-spark - 在 Cassandra 中通过数据帧的并行线程插入
- java - java替换数组的元素