【问题标题】:unexpected null in start extracting text in InputMethodService在 InputMethodService 中开始提取文本时出现意外 null
【发布时间】:2015-08-01 15:58:36
【问题描述】:
我正在开发软键盘,一切正常,但是当我更改 orientation 时会出现以下错误
"Unexpected null in startExtractingText : mExtractedText = null, input connection = com.android.internal.view.InputConnectionWrapper"
同时关闭输入视图
我不知道如何解决这个问题,请帮忙。
【问题讨论】:
标签:
android
android-input-method
【解决方案1】:
我发现了问题
当外部应用程序强制关闭输入视图时,它会抛出
开始提取文本null
【解决方案2】:
我也遇到过同样的问题。我已经解决了这个问题。就我而言,我在重写方法 setExtractView(View view) 上添加了自定义视图。但我并没有先删除视图。
让我解释一下:
@Override
public void setExtractView(View view) {
// You have to do this if you are not doing so
view.removeAllViews() ; // This is the line
view.addView(yourView) ; // Here you can put your own Custom view
super.setExtractView(view);
}
这对我有用。我希望这会对你有所帮助。