I've been struggling for a while, but without success. My question is simple, how do I retrieve an ArrayList<Uri>
of download URIs and be able to use this ArrayList
later on since this task is asynchronous? I've tried using a callback, but it's not working.
For example this
public getAllDownloadURIs(final FirestoreCallback
firestoreCallback) {
final ArrayList<Uri> uris = new ArrayList<>();
for (StorageReference storageReference : referencesToFiles) {
storageReference.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
@Override
public void onSuccess(Uri uri) {
uris.add(uri);
}
});
firestoreCallback.onCallback(uris);
}
private interface FirestoreCallback {
void onCallback(List<Uri> uris);
}