gpt4 book ai didi

java - NullPointerException (@PhoneWindow :onKeyUpPanel:1002) {main}

转载 作者:搜寻专家 更新时间:2023-10-30 19:51:37 25 4
gpt4 key购买 nike

我最近在分析中遇到奇怪的异常。

java.lang.NullPointerException
at com.android.internal.policy.impl.PhoneWindow.onKeyUpPanel(PhoneWindow.java:1002)
at com.android.internal.policy.impl.PhoneWindow.onKeyUp(PhoneWindow.java:1703)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:2114)
at android.view.ViewRootImpl.deliverKeyEventPostIme(ViewRootImpl.java:3626)
at android.view.ViewRootImpl.handleImeFinishedEvent(ViewRootImpl.java:3596)
at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:2839)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4904)
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 解决此问题(可能需要几个月,具体取决于他们发布新固件所需的时间),以下解决方法对我有效。只需将以下代码添加到您的 Activity 类中:

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

关于java - NullPointerException (@PhoneWindow :onKeyUpPanel:1002) {main},我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26833242/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com