I need to traverse the Firebase schema to get data for each workouts
& display it in a RecyclerView.
Now I can\'t traverse the Schema in the Firebase using
As @ReazMurshed said, you're almost there. But you're failing to iterate over one level in your tree. It seems that ref is pointing to the subscriptions
node in your JSON. Under that you have users and then you have the push ids. So you'll need to do a double loop:
ref.addListenerForSingleValueEvent(new ValueEventListener) {
public void onDataChange(DataSnapshot snapshot) {
if (dataSnapshot.exists()) {
for (DataSnapshot userSnapshot : snapshot.getChildren()) {
for (DataSnapshot programSnapshot : userSnapshot.getChildren()) {
Program program = programSnapshot.getValue(Program.class);
}
}
}
public void onCancelled(FirebaseError firebaseError) {
}
});