我想从我的火力数据库中获取smth3的参考如何让孩子火力数据库
|smth1
---|smth2
---|smth3
---|smth4
---|smth5
代码的参考:
DatabaseReference mDatabase = FirebaseDatabase.getInstance().getReference().child("smth1")
.child("smth2");
mDatabase.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
int count = 0;
DataSnapshot needSnapshot = null;
for (DataSnapshot snapshot : dataSnapshot.getChildren()){
needSnapshot = snapshot;
if(count == getPosition()){
break;
}
count++;
}
mDatabase.child(needSnapshot.getKey()).removeValue();
notifyItemRemoved(getPosition());
notifyItemRangeChanged(getPosition(), getItemCount());
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
这个代码总是删除smth2。
越来越基准后,我想与所有的孩子们将其删除和值 请帮助加入这个依赖于你的应用程序级的建造得到的smth3