第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Firebase 數(shù)據(jù)庫“onDataChange”方法 NullPointerException

Firebase 數(shù)據(jù)庫“onDataChange”方法 NullPointerException

郎朗坤 2023-07-28 16:04:35
您好,很抱歉,如果這個問題很明顯,但是自從兩天以來,我遇到了空指針異常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: 9Disconnected from the target VM, address: 'localhost:8617', transport: 'socket'我知道 Firebase 是異步的,返回值為 null,但它是隨機(jī)來來去去的。這是它所使用的類。如果有人知道為什么會發(fā)生這種情況那就太好了,我們多年來一直致力于解決這個問題,但似乎無法解決它。提前致謝!
查看完整描述

1 回答

?
慕村225694

TA貢獻(xiàn)1880條經(jīng)驗 獲得超4個贊

看起來您的代碼從未調(diào)用initIngredients()來創(chuàng)建數(shù)據(jù)庫回調(diào)所需的所有 ArrayList 對象。它們最初都是空的,嘗試向其中之一添加某些內(nèi)容將導(dǎo)致該錯誤。



查看完整回答
反對 回復(fù) 2023-07-28
  • 1 回答
  • 0 關(guān)注
  • 121 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號