Answers for "count the number of times data apears in firebase database"

0

count the number of times data apears in firebase database

databaseReference = FirebaseDatabase.getInstance().getReference().child("Attendance").child(istrustnumberavailable);
    databaseReference.limitToFirst(5);

    Query query = databaseReference.orderByChild("name").equalTo("prof");

    ChildEventListener removedListener = query.addChildEventListener(new ChildEventListener() {
        @Override
        public void onChildAdded(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {

            if (dataSnapshot.exists()){

              long  count=  dataSnapshot.getChildrenCount();


            }


        }

        @Override
        public void onChildChanged(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {

            if (dataSnapshot.exists()){

                long  count=  dataSnapshot.getChildrenCount();


            }


        }

        @Override
        public void onChildRemoved(@NonNull DataSnapshot dataSnapshot) {

            if (dataSnapshot.exists()){

                long  count=  dataSnapshot.getChildrenCount();


            }



        }

        @Override
        public void onChildMoved(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {


        }

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

        }
    });
Posted by: Guest on March-03-2021

Code answers related to "count the number of times data apears in firebase database"

Browse Popular Code Answers by Language