gpt4 book ai didi

android - 尝试在空对象上调用虚拟方法 ‘android.os.Handler android.support.v4.app.FragmentHostCallback.getHandler()’

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:14:57 25 4
gpt4 key购买 nike

Attempt to invoke virtual method 'android.os.Handler android.support.v4.app.FragmentHostCallback.getHandler()' on a null object reference
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1588)
at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:330)
at android.support.v4.app.FragmentActivity.onResume(FragmentActivity.java:441)
at com.app.rare10.activities.ViewAllMemberActivity.onResume(ViewAllMemberActivity.java:192)
at com.app.rare10.activities.ViewAllMemberActivity$1.onReceive(ViewAllMemberActivity.java:74)
at android.support.v4.content.LocalBroadcastManager.executePendingBroadcasts(LocalBroadcastManager.java:297)
at android.support.v4.content.LocalBroadcastManager.access$000(LocalBroadcastManager.java:46)
at android.support.v4.content.LocalBroadcastManager$1.handleMessage(LocalBroadcastManager.java:116)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698

我在我的项目中使用了推送通知,每当我点击我的通知时,我都会收到上面的错误。帮忙?

最佳答案

我使用了一个 bool 值来防止 Activity 被破坏并恢复。

boolean hasStop;
.
.
.
.
//here is when I need to prevent
if(!hasStop)
//Statement
.
.
.
@Override
protected void onDestroy() {
super.onDestroy();
hasStop=true;
}

@Override
protected void onResume() {
super.onResume();
hasStop=false;
}

关于android - 尝试在空对象上调用虚拟方法 ‘android.os.Handler android.support.v4.app.FragmentHostCallback.getHandler()’,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37941263/

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