I am having trouble adding values from my Firebase Realtime Database to a List. The values are being retrieved properly, and can be printed, however- I am unable to add these values to a list. What am I doing wrong?
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for (DataSnapshot collectionSnapshot : dataSnapshot.getChildren()) {
collectionName = collectionSnapshot.child("name").getValue(String.class);
names.add(collectionName);
count = collectionSnapshot.child("progress").getValue(int.class);
numbers.add(count);
Toast.makeText(CollectionGraph.this, collectionName + count, Toast.LENGTH_SHORT).show();
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
I'm attempting to use the values within the two arrays on a pie chart, however, upon running the app, I am met with an empty pie chart Empty output Firebase Realtime Database