privateChatManager.addPrivateChatManagerListener(本);从对话框活动中第二次打开聊天框时为null。一个快速的解决方法是重新登录聊天并创建一个新会话,但错误仍然存在。有人可以帮助解决此问题。在调试时,发现QBChatService.getInstance()已初始化,但.getPrivateChatManager();是空的。
if(privateChatManager == null){
privateChatManager = QBChatService.getInstance().getPrivateChatManager();
privateChatManager.addPrivateChatManagerListener(this);
}
日志:
06-29 10:14:02.335: E/AndroidRuntime(12904): FATAL EXCEPTION: main
06-29 10:14:02.335: E/AndroidRuntime(12904): java.lang.RuntimeException: Unable to resume activity {com.tchat/com.tchat.quickblox.ChatActivity}: java.lang.NullPointerException
06-29 10:14:02.335: E/AndroidRuntime(12904): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2828)
06-29 10:14:02.335: E/AndroidRuntime(12904): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2857)
06-29 10:14:02.335: E/AndroidRuntime(12904): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2304)
06-29 10:14:02.335: E/AndroidRuntime(12904): at android.app.ActivityThread.access$700(ActivityThread.java:154)
06-29 10:14:02.335: E/AndroidRuntime(12904): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1284)
06-29 10:14:02.335: E/AndroidRuntime(12904): at android.os.Handler.dispatchMessage(Handler.java:99)
06-29 10:14:02.335: E/AndroidRuntime(12904): at android.os.Looper.loop(Looper.java:137)
06-29 10:14:02.335: E/AndroidRuntime(12904): at android.app.ActivityThread.main(ActivityThread.java:5306)
06-29 10:14:02.335: E/AndroidRuntime(12904): at java.lang.reflect.Method.invokeNative(Native Method)
06-29 10:14:02.335: E/AndroidRuntime(12904): at java.lang.reflect.Method.invoke(Method.java:511)
06-29 10:14:02.335: E/AndroidRuntime(12904): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
06-29 10:14:02.335: E/AndroidRuntime(12904): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
06-29 10:14:02.335: E/AndroidRuntime(12904): at dalvik.system.NativeStart.main(Native Method)
06-29 10:14:02.335: E/AndroidRuntime(12904): Caused by: java.lang.NullPointerException
06-29 10:14:02.335: E/AndroidRuntime(12904): at com.tchat.quickblox.core.PrivateChatImpl.initManagerIfNeed(PrivateChatImpl.java:54)
06-29 10:14:02.335: E/AndroidRuntime(12904): at com.tchat.quickblox.core.PrivateChatImpl.<init>(PrivateChatImpl.java:34)
06-29 10:14:02.335: E/AndroidRuntime(12904): at com.tchat.quickblox.voip.fragment.ChatFragment.initChat(ChatFragment.java:369)
06-29 10:14:02.335: E/AndroidRuntime(12904): at com.tchat.quickblox.voip.fragment.ChatFragment.onCreateView(ChatFragment.java:106)
06-29 10:14:02.335: E/AndroidRuntime(12904): at android.app.Fragment.performCreateView(Fragment.java:1699)
06-29 10:14:02.335: E/AndroidRuntime(12904): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:903)
06-29 10:14:02.335: E/AndroidRuntime(12904): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1075)
06-29 10:14:02.335: E/AndroidRuntime(12904): at android.app.BackStackRecord.run(BackStackRecord.java:682)
06-29 10:14:02.335: E/AndroidRuntime(12904): at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1455)
06-29 10:14:02.335: E/AndroidRuntime(12904): at android.app.Activity.performResume(Activity.java:5344)
06-29 10:14:02.335: E/AndroidRuntime(12904): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2818)
06-29 10:14:02.335: E/AndroidRuntime(12904): ... 12 more
答案 0 :(得分:0)
我使用LG Nexus(Android 6.0)遇到过这个问题,但很少有三星设备工作正常。有问题的版本是2.5.2。现在我已将Quickblox更新为2.6,并且我没有遇到任何关于私人聊天管理器的崩溃或错误。