运维开发网

Java android.support.v7.app.ActionBarImplICS.getThemedContext Android中的NullPointerException

运维开发网 https://www.qedev.com 2020-04-09 16:12 出处:网络 作者:运维开发网整理
请帮助我获取 java.lang.NullPointerException 在Google Play开发者控制台的android.support.v7.app.ActionBarImplICS.getThemedContext中,但是当我测试它时,我没有收到任何错误或崩溃,请告诉我导致崩溃的原因以及如何解决问题.错误如下所示,如果需要,我也可以共享代码. java.lang.NullPointer
请帮助我获取 java.lang.NullPointerException

在Google Play开发者控制台的android.support.v7.app.ActionBarImplICS.getThemedContext中,但是当我测试它时,我没有收到任何错误或崩溃,请告诉我导致崩溃的原因以及如何解决问题.错误如下所示,如果需要,我也可以共享代码.

java.lang.NullPointerException
at android.support.v7.app.ActionBarImplICS.getThemedContext(ActionBarImplICS.java:287)
at android.support.v7.app.ActionBarImplJB.getThemedContext(ActionBarImplJB.java:20)
at android.support.v7.app.ActionBarActivityDelegate.getActionBarThemedContext(ActionBarActivityDelegate.java:207)
at android.support.v7.app.ActionBarActivityDelegateICS.onActionModeStarted(ActionBarActivityDelegateICS.java:196)
at android.support.v7.app.ActionBarActivityDelegateICS$WindowCallbackWrapper.onActionModeStarted(ActionBarActivityDelegateICS.java:351)
at com.android.internal.policy.impl.PhoneWindow$DecorView.startActionMode(PhoneWindow.java:2292)
at com.android.internal.policy.impl.PhoneWindow$DecorView.startActionModeForChild(PhoneWindow.java:2215)
at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:619)
at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:619)
at android.view.View.startActionMode(View.java:4191)
at android.webkit.WebViewClassic.startSelectActionMode(WebViewClassic.java:5049)
at android.webkit.WebViewClassic.setupWebkitSelect(WebViewClassic.java:5178)
at android.webkit.WebViewClassic.updateTextSelectionFromMessage(WebViewClassic.java:7929)
at android.webkit.WebViewClassic.access$4300(WebViewClassic.java:147)
at android.webkit.WebViewClassic$PrivateHandler.handleMessage(WebViewClassic.java:7249)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
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:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
这从 https://stackoverflow.com/a/19320065/619673解决了我的问题

我为我的活动添加了这段代码,因为我在Activity中使用了主题“NO TITLE”.

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if ( keyCode == KeyEvent.KEYCODE_MENU ) {
        // do nothing
        return true;
    }
    return super.onKeyDown(keyCode, event);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消