onKeyUpPanel 上的空指针?
Null Pointer on onKeyUpPanel?
我刚刚收到以下崩溃报告,我什至不知道我能做些什么来解决这个问题。报告的 Android 版本是 4.1,设备是 LG Optimus G。关于我能做什么有什么想法吗?请注意,没有一行是我的代码,都是内部 Android 的东西,我什至不确定它是如何报告给我的...
java.lang.NullPointerException
at com.android.internal.policy.impl.PhoneWindow.onKeyUpPanel(PhoneWindow.java:986)
at com.android.internal.policy.impl.PhoneWindow.onKeyUp(PhoneWindow.java:1687)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:2098)
at android.view.ViewRootImpl.deliverKeyEventPostIme(ViewRootImpl.java:3621)
at android.view.ViewRootImpl.handleImeFinishedEvent(ViewRootImpl.java:3591)
at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:2834)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4905)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)
这似乎是一个已知的 LG 问题。要解决,add the following code,这将解决 LG 错误:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_MENU && "LGE".equalsIgnoreCase(Build.BRAND)) {
return true;
}
return super.onKeyDown(keyCode, event);
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_MENU && "LGE".equalsIgnoreCase(Build.BRAND)) {
openOptionsMenu();
return true;
}
return super.onKeyUp(keyCode, event);
}
我刚刚收到以下崩溃报告,我什至不知道我能做些什么来解决这个问题。报告的 Android 版本是 4.1,设备是 LG Optimus G。关于我能做什么有什么想法吗?请注意,没有一行是我的代码,都是内部 Android 的东西,我什至不确定它是如何报告给我的...
java.lang.NullPointerException
at com.android.internal.policy.impl.PhoneWindow.onKeyUpPanel(PhoneWindow.java:986)
at com.android.internal.policy.impl.PhoneWindow.onKeyUp(PhoneWindow.java:1687)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:2098)
at android.view.ViewRootImpl.deliverKeyEventPostIme(ViewRootImpl.java:3621)
at android.view.ViewRootImpl.handleImeFinishedEvent(ViewRootImpl.java:3591)
at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:2834)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4905)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)
这似乎是一个已知的 LG 问题。要解决,add the following code,这将解决 LG 错误:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_MENU && "LGE".equalsIgnoreCase(Build.BRAND)) {
return true;
}
return super.onKeyDown(keyCode, event);
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_MENU && "LGE".equalsIgnoreCase(Build.BRAND)) {
openOptionsMenu();
return true;
}
return super.onKeyUp(keyCode, event);
}