There is a Firebase database, how to get the number of children child elements from it? enter image description here

  • No More precisely for this you can use CloudFunctions - these are some scripts on nodeJs executed on the side of Google servers. In short, there is no simple solution and it will not be, they were asked to do it four years ago, but they don’t do it - YuriySPb

1 answer 1

Use dataSnapshot.getChildrenCount()

 mPostDatabase.child("books").addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { tvWoowCount.setText(""+dataSnapshot.getChildrenCount()); } }); 

There is a similar example:

https://stackoverflow.com/questions/46256847/get-firebase-children-count