📜  java代码示例中firebase快照中的for循环

📅  最后修改于: 2022-03-11 14:52:32.311000             🧑  作者: Mango

代码示例1
FirebaseDatabase database = FirebaseDatabase.getInstance();
DatabaseReference myRef = database.getReference();
myRef.addValueEventListener(new ValueEventListener() {
 @Override
 public void onDataChange(DataSnapshot dataSnapshot) {
    for(DataSnapshot item_snapshot:dataSnapshot.getChildren()) {

      Log.d("item id ",item_snapshot.child("item_id").getValue().toString());
      Log.d("item desc",item_snapshot.child("item_desc").getValue().toString());
     }
  }
}