Q:

Get users that have "x" in firebase database in android studio

I put data in realtime database like this: 

And I want FOR EVERY user (in this case KXya0 ...) to get "zile" 
I have this code 
databaseReference.addValueEventListener(new ValueEventListener()
{
    @Override
    public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
        if (dataSnapshot.exists() && dataSnapshot.getChildrenCount() > 0) {
            String day = dataSnapshot.child("ck").child("zile").getValue().toString();
            Toast.makeText(CalendarClienti.this, day, Toast.LENGTH_SHORT).show();

        }
    }
    @Override
    public void onCancelled (DatabaseError databaseError){

    }
});

I know that i need to say smth like child(user).child("zile") etc.. But I want to do it for all the users. How can I do that?

A:

You can reference your query to Agenti and then iterate through each user to get zile like below:
DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference().child("Agenti");
databaseReference.addListenerForSingleValueEvent(new ValueEventListener() {
    @Override
    public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
        for(DataSnapshot childSnapshot: dataSnapshot.getChildren()) {
            if (childSnapshot.exists() && childSnapshot.getChildrenCount() > 0) {
                String day = childSnapshot.child("ck").child("zile").getValue().toString();
                Toast.makeText(CalendarClienti.this, day, Toast.LENGTH_SHORT).show();
            }
        }
    }

    @Override
    public void onCancelled(@NonNull DatabaseError databaseError) {

    }
});

