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

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

安卓 火庫 實時數(shù)據(jù)庫 獲取節(jié)點子級時出現(xiàn)錯誤

安卓 火庫 實時數(shù)據(jù)庫 獲取節(jié)點子級時出現(xiàn)錯誤

慕少森 2022-09-28 09:53:42
我有一個非常奇怪的問題。此代碼幾天前仍在工作,但現(xiàn)在它正在使我的應(yīng)用程序崩潰。我正在嘗試循環(huán)訪問節(jié)點子節(jié)點。private void getInfo(){    FirebaseDatabase.getInstance().getReference()            .child("ForumResponses").child(forumID).addListenerForSingleValueEvent(new ValueEventListener()    {        @Override        public void onDataChange(@NonNull DataSnapshot dataSnapshot)        {            for(DataSnapshot snap : dataSnapshot.getChildren())            {                ForumResponses forumResponses = snap.getValue(ForumResponses.class);            }        }        @Override        public void onCancelled(@NonNull DatabaseError databaseError)        {        }    });}如果我刪除下面的代碼行,應(yīng)用程序不會崩潰。這是為什么呢?ForumResponses forumResponses = snap.getValue(ForumResponses.class);下面是錯誤日志    com.google.firebase.database.DatabaseException: Failed to convert a value of type java.util.HashMap to int    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.convertInteger(com.google.firebase:firebase-database@@16.1.0:351)    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.deserializeToPrimitive(com.google.firebase:firebase-database@@16.1.0:272)    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.deserializeToClass(com.google.firebase:firebase-database@@16.1.0:197)    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.deserializeToType(com.google.firebase:firebase-database@@16.1.0:178)    at com.google.firebase.database.core.utilities.encoding.CustomClassMapper.access$100(com.google.firebase:firebase-database@@16.1.0:47)
查看完整描述

1 回答

?
ITMISS

TA貢獻1871條經(jīng)驗 獲得超8個贊

您會收到以下錯誤:

數(shù)據(jù)庫異常: 無法將 java.util.HashMap 類型的值轉(zhuǎn)換為整數(shù)

因為類中的字段類型是 和 數(shù)據(jù)庫中的字段,因為該字段實際上是一個對象。要解決此問題,請將數(shù)據(jù)庫中的字段轉(zhuǎn)換為 ,或?qū)㈩愔凶侄蔚念愋透臑?.likedForumResponsesintintForumResponsesMap<String, Object>


查看完整回答
反對 回復 2022-09-28
  • 1 回答
  • 0 關(guān)注
  • 109 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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