2 回答

TA貢獻(xiàn)1803條經(jīng)驗(yàn) 獲得超6個(gè)贊
這行不通,因?yàn)槟枰钜粚?,還有一個(gè)孩子,我不知道您是如何創(chuàng)建它的
ref2=db.getReference("HiringWalker").child(FirebaseAuth.getInstance().getCurrentUser().getUid());
改為這樣做
ref2=db.getReference("HiringWalker").child("ciu12tcL4RfzmC3T6Gdp64LgiZa2").child(FirebaseAuth.getInstance().getCurrentUser().getUid());
檢查您在哪里創(chuàng)建它ciu12tcL4RfzmC3T6Gdp64LgiZa2
并將其替換.child("ciu12tcL4RfzmC3T6Gdp64LgiZa2")
為生成該隨機(jī)數(shù)的當(dāng)前實(shí)現(xiàn)

TA貢獻(xiàn)1799條經(jīng)驗(yàn) 獲得超6個(gè)贊
您的查詢是正確的,但獲取數(shù)據(jù)不正確,應(yīng)該從
ref2.addValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
infoList.clear();
for (DataSnapshot infoSnapshot : dataSnapshot.getChildren())
{
for (DataSnapshot infomationsnap : infoSnapshot.getChildren())
{
ReWalker rewalker = infomationsnap.getValue(ReWalker.class)
infoList.add(rewalker);
}
}
});
到
ref2.addValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
infoList.clear();
for (DataSnapshot infoSnapshot : dataSnapshot.getChildren())
{
ReWalker rewalker = infoSnapshot.getValue(ReWalker.class)
infoList.add(rewalker);
}
});
添加回答
舉報(bào)