我有一个自定义键盘应用程序,当我按下后退按钮退出它时,我得到这个 LogCat 输出的时间大约是 1/4:
12-19 13:18:13.908: W/InputMethodManager(361): IME died: com.mypackage/.MyActivity dropping: KeyEvent{action=1 code=4 repeat=0 meta=0 scancode=158 mFlags=72}
12-19 13:18:13.908: W/InputMethodManager(361): android.os.DeadObjectException
12-19 13:18:13.908: W/InputMethodManager(361): at android.os.BinderProxy.transact(Native Method)
12-19 13:18:13.908: W/InputMethodManager(361): at com.android.internal.view.IInputMethodSession$Stub$Proxy.dispatchKeyEvent(IInputMethodSession.java:277)
12-19 13:18:13.908: W/InputMethodManager(361): at android.view.inputmethod.InputMethodManager.dispatchKeyEvent(InputMethodManager.java:1344)
12-19 13:18:13.908: W/InputMethodManager(361): at android.view.ViewRoot.deliverKeyEvent(ViewRoot.java:2426)
12-19 13:18:13.908: W/InputMethodManager(361): at android.view.ViewRoot.handleMessage(ViewRoot.java:1741)
12-19 13:18:13.908: W/InputMethodManager(361): at android.os.Handler.dispatchMessage(Handler.java:99)
12-19 13:18:13.908: W/InputMethodManager(361): at android.os.Looper.loop(Looper.java:123)
12-19 13:18:13.908: W/InputMethodManager(361): at android.app.ActivityThread.main(ActivityThread.java:4627)
12-19 13:18:13.908: W/InputMethodManager(361): at java.lang.reflect.Method.invokeNative(Native Method)
12-19 13:18:13.908: W/InputMethodManager(361): at java.lang.reflect.Method.invoke(Method.java:521)
12-19 13:18:13.908: W/InputMethodManager(361): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-19 13:18:13.908: W/InputMethodManager(361): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-19 13:18:13.908: W/InputMethodManager(361): at dalvik.system.NativeStart.main(Native Method)
有没有人遇到过这个?
这是我覆盖后退按钮时的代码
if(mInputView.getVisibility() == View.VISIBLE){
if(isInputViewShown()){
if(output != null){
if(getCurrentInputConnection() != null){
getCurrentInputConnection().deleteSurroundingText(1000, 1000);
getCurrentInputConnection().commitText(output.getText(), output.length());
}
output.setText("");
}
requestHideSelf(0);
return true;
}else return false;