三星:断电时InputMethodService崩溃(NullPointerException)

时间:2017-11-29 06:08:30

标签: android nullpointerexception android-input-method uncaught-exception android-anr-dialog

无法检测到此问题。此问题特定于Samsung Device。

我在日志中得到的另一件事:

"Unexpected null in startExtractingText : mExtractedText = null, input connection = com.android.internal.view.InputConnectionWrapper"


11-23 15:44:06.463 21778-21778/? W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.inputmethodservice.InputMethodService.forceExtractEditTextClose()' on a null object reference
11-23 15:44:06.463 21778-21778/? W/System.err:     at android.inputmethodservice.ExtractEditText.onScreenStateChanged(ExtractEditText.java:246)
11-23 15:44:06.463 21778-21778/? W/System.err:     at android.view.View.dispatchScreenStateChanged(View.java:15375)
11-23 15:44:06.463 21778-21778/? W/System.err:     at android.view.ViewGroup.dispatchScreenStateChanged(ViewGroup.java:3164)
11-23 15:44:06.463 21778-21778/? W/System.err:     at android.view.ViewGroup.dispatchScreenStateChanged(ViewGroup.java:3164)
11-23 15:44:06.463 21778-21778/? W/System.err:     at android.view.ViewGroup.dispatchScreenStateChanged(ViewGroup.java:3164)
11-23 15:44:06.463 21778-21778/? W/System.err:     at android.view.ViewGroup.dispatchScreenStateChanged(ViewGroup.java:3164)
11-23 15:44:06.463 21778-21778/? W/System.err:     at android.view.ViewGroup.dispatchScreenStateChanged(ViewGroup.java:3164)
11-23 15:44:06.463 21778-21778/? W/System.err:     at android.view.ViewGroup.dispatchScreenStateChanged(ViewGroup.java:3164)
11-23 15:44:06.463 21778-21778/? W/System.err:     at android.view.ViewGroup.dispatchScreenStateChanged(ViewGroup.java:3164)
11-23 15:44:06.463 21778-21778/? W/System.err:     at android.view.ViewGroup.dispatchScreenStateChanged(ViewGroup.java:3164)
11-23 15:44:06.463 21778-21778/? W/System.err:     at android.view.ViewRootImpl$1.onDisplayChanged(ViewRootImpl.java:1171)
11-23 15:44:06.463 21778-21778/? W/System.err:     at android.hardware.display.DisplayManagerGlobal$DisplayListenerDelegate.handleMessage(DisplayManagerGlobal.java:724)
11-23 15:44:06.463 21778-21778/? W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:102)
11-23 15:44:06.463 21778-21778/? W/System.err:     at android.os.Looper.loop(Looper.java:158)
11-23 15:44:06.463 21778-21778/? W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:7225)
11-23 15:44:06.463 21778-21778/? W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
11-23 15:44:06.463 21778-21778/? W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
11-23 15:44:06.463 21778-21778/? W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

1 个答案:

答案 0 :(得分:0)

我已经自己解决了这个问题。在我的例子中,我在覆盖方法setExtractView(视图视图)上添加了我的自定义视图。但我并没有先删除观点。

让我解释一下:

@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);
} 

这对我有用。我希望当你遇到像

这样的问题时,这会对你有所帮助
"Unexpected null in startExtractingText : mExtractedText = null, input connection = com.android.internal.view.InputConnectionWrapper"