I want to retrieve a list of data in Firebase and store it locally in my ArrayList
. I want to get the number of count inside the ArrayList
.
mFirebaseDatabase.getReference("attendance").child(MainActivity.userName).child(subCode).child("student_absences").addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for (DataSnapshot child : dataSnapshot.getChildren()) {
StudentAttendance attendanceInit = child.getValue(StudentAttendance.class);
ss.add(attendanceInit);
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
// here i want to get the size by using ss.size() but my above code, the size is always zero