I am trying to get data in a two specific field in each document where one field is a integer and the other is a string. I want each field to be stored in an array separately.
db.collection("Activity")
.whereEqualTo("plan_id", plan_id)
.get()
.addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
@Override
public void onComplete(@NonNull Task<QuerySnapshot> task) {
if (task.isSuccessful()) {
List<Long> progressList = new ArrayList<>();
List<String> titleList = new ArrayList<>();
for (QueryDocumentSnapshot document : task.getResult()) {
Log.d(TAG, document.getId() + " => " + document.get("progress"));
}
} else {
Log.d(TAG, "Error getting documents: ", task.getException());
}
}
});
I've tried
int[] prog = (int[]) document.get("progress");
String[] title = (String[]) document.get("title");
but no luck...
ArrayorList? Because I saw there were 2 declarations ofListfor progress and title, respectively.