Filter Firebase Database DataSnapshot children on Android

Viewed 2000

I want to query the data from Firebase on Android. And this is my data my data

And this is my Android Studio code :

Firebase myFirebaseRef = new Firebase("https://....../myCoffee/"+phone+"");
            myFirebaseRef.addValueEventListener(new ValueEventListener() {
                @Override
                public void onDataChange(DataSnapshot snapshot) {
                    int size= (int) snapshot.getChildrenCount();
                    txtMyCoffee.setText(""+size);
                          }
                @Override
                public void onCancelled(FirebaseError firebaseError) {
                }
            });

Question : The total count of the children is 4. How would I filter the children to only count children whose "coffeeNo" is "Acoffee"?

3 Answers
Related