Async task could not keep up with for loop (firebase)
问题 for (Uri mUri : mSelected) { imagesRef = storageRef.child(postid + mUri.getLastPathSegment()); imagesRef.putFile(mUri).addOnSuccessListener(task4 -> db.collection("posts").document(postid).update("photo_id", FieldValue.arrayUnion(imagesRef.getDownloadUrl()))); } So, now i am working with firestore and firebase storage. I uploaded (multiple) images to the storage, and when it is uploaded, i get the download url and wants to add it into my firestore. So, the problem is, only the last image is