I'm trying to retrieve all field names from a document (the document name is the userID) under a collection called "taskboards". I want Firestore to retrieve these field names in a specific order but I don't know how.
Here is the following code:
userID = fAuth.getCurrentUser().getUid();
DocumentReference userTaskboardRef = fStore.collection("taskboards").document(userID)
userTaskboardRef.get().addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
@Override
public void onComplete(@NonNull Task<DocumentSnapshot> task) {
if(task.isSuccessful()){
List<String> columnsList = new ArrayList<>();
Map<String, Object> map = task.getResult().getData();
for(Map.Entry<String, Object> entry : map.entrySet()){
columnsList.add(entry.getKey());
Log.d("TAG", entry.getKey());
Log.d("TAG", entry.getValue().toString());
}
For example:
I would like Firestore to retrieve the following field names in the order "To Do, Doing, Done". Here is a picture of how the field names are stored in my Firestore.
The above code works and retrieves the field names but it retrieves them in the order "Doing, To Do, Done". Here is a picture of TAG showing the order.
I'm quite new to Android Studio so can anybody help me out? Is it even possible to specify the order in which the field names are retrieved?