我刚刚接到了下面的车祸报告,我一点也不知道我能做些什么来解决这个问题。据报道,Android版本是4.1,该设备是LG擎天柱G。有什么想法,我可以做什么?请注意,没有一行是我的代码,它都是内部安卓的东西,我甚至不确定它是如何报告给我的…

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 - 在onKeyUpPanel上是否有空指针?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/28137121/

10-12 06:26