Это моя структура базы данных Firebase.
Я хочу получить значения "Всего" всех детей "Билла".Я пытался получить данные, но мой код не работает.Вот мой код
DatabaseReference billReference = FirebaseDatabase.getInstance().getReference().child("Bill");
billReference.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
int i = 0;
for (DataSnapshot ds : dataSnapshot.getChildren()) {
fetchCount++;
Toast.makeText(getApplicationContext(),""+keys[i],Toast.LENGTH_LONG).show();
String temp = ds.child(keys[i]).child("Breakfast").child("11-2018").child("Total").getValue().toString();
breakfastBills.add(names[i] + " : " + temp);
i++;
}
if (fetchCount == 4) {
AlertDialog.Builder builder = new AlertDialog.Builder(bill_details_manager.this);
builder.setTitle("Bill Details for Breakfast");
builder.setItems(breakfastBills.toArray(new String[breakfastBills.size()]), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
});
progressDialog.dismiss();
AlertDialog alertDialog = builder.create();
alertDialog.show();
}
Что не так с этим кодом?