Skip to content Skip to sidebar Skip to footer

Firebase Orderbykey Doesn't Work

I have an object. { featured-routines: { 1465895195: '-LALALA' 1465898164: '-KK7pEednXoUBszpqCmg' 1465898185: '-KK9xFyA8skOvSLhaHWq' } } and I try to get them by calling: Dat

Solution 1:

To handle the children in the order you request them, you have to either use a ChildEvenListener or DataSnapshot.getChildren() within your ValueEventListener:

    ValueEventListener routineListener = new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot snapshot) {
            for (DataSnapshot child : snapshot.getChildren()) {
                Systme.out.println(snapshot.getKey());
            }
        }
        ...
    });

Post a Comment for "Firebase Orderbykey Doesn't Work"