My Object:
public class School{
TreeMap<String, int> classes = new TreeMap<>();
}
This is how I save the objects to Firebase Realtime DB:
mDatabase.child("School").setValue(school);
This is how I retrieve the objects fromFirebase Realtime DB:
ValueEventListener listener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
SChool s = dataSnapshot.getValue(School.class);
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
};
The problem: Using TreeMap should ensure the ordering of keys, which are always written correctly on the DB as shown below:
Testing the app on various emulators and physical devices shows expected normal behavior, which is the viewing of Classes in an ascending sorting manner same as what is visible on the DB above.
However, I get complains from app users that the list has no sorting order at all on their devices. These devices include: Huawei Mate 8, Oppo F9.
I am losing my mind, Am I missing something here?