0

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);
    }
Alex
  • 41
  • 1
  • 7

1 Answers1

0

Please check your path once and for more reference check out link below.

https://stackoverflow.com/a/37379251/10838454

Harsh Suvagiya
  • 106
  • 1
  • 3