How To Convert A Map Into Arraylist From Firestore Document
My goal is to get query a collection and get the documents each document has three or five hashmap in it .my aim is to get the documents with different id's and populate in nested
Solution 1:
It looks like you want to parse the map to get values, you can do this for multiple keys:
for (Map.Entry<String, PostBattle> params : batPost.entrySet()) {
if (params.getKey().equals("imageuri")) { // or something else//add to your arraylist
}
}
or if you require only one:
Stringimageuri= batPost.getKey("imageuri").toString();
add the above image uri to your arraylist
If you want to seperate on basis of ids:
Map<String, yourobject> idmaps = document.getData();
for (Map.Entry<String, yourobject> id : idmaps.entrySet()) {
// do your code here// first get the id String userid = id.getKey();
//then do what you have done above
yourobject = id.getValue();
// do your logic on above object this will seperate your userids
}
Post a Comment for "How To Convert A Map Into Arraylist From Firestore Document"