您好,很抱歉,如果这个问题很明显,但是自从两天以来,我遇到了空指针异常
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.myapplicationteeeeeeeeeest, PID: 13439
java.lang.NullPointerException: Attempt to invoke virtual method 'void java.util.ArrayList.add(int, java.lang.Object)' on a null object reference
at com.example.myapplicationteeeeeeeeeest.ui.FSettings.SettingsFragment$4.onDataChange(SettingsFragment.java:336)
at com.google.firebase.database.Query$1.onDataChange(com.google.firebase:firebase-database@@19.0.0:179)
at com.google.firebase.database.core.ValueEventRegistration.fireEvent(com.google.firebase:firebase-database@@19.0.0:75)
at com.google.firebase.database.core.view.DataEvent.fire(com.google.firebase:firebase-database@@19.0.0:63)
at com.google.firebase.database.core.view.EventRaiser$1.run(com.google.firebase:firebase-database@@19.0.0:55)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
I/Process: Sending signal. PID: 13439 SIG: 9
Disconnected from the target VM, address: 'localhost:8617', transport: 'socket'
我知道 Firebase 是异步的,返回值为 null,但它是随机来来去去的。这是它所使用的类。
如果有人知道为什么会发生这种情况那就太好了,我们多年来一直致力于解决这个问题,但似乎无法解决它。提前致谢!
慕村225694
相关分类