简体   繁体   English

从 Firebase 存储获取多个 URL

[英]Getting multiple URLs from Firebase Storage

Needed: For my app, I need an ArrayList of all urls in a Firebase Storage from a subfolder of said storage.需要:对于我的应用程序,我需要来自所述存储的子文件夹的 Firebase 存储中所有 url 的 ArrayList。

I have created the reference in which all of the images are located:我创建了所有图像所在的参考:

StorageReference storageRefFemale = FirebaseStorage.getInstance().getReference().child("profileImages").child("femaleProfileImages"); 

Question: How do I go about acquiring all of the urls included within?问题:我如何获取所有包含在其中的 url? I will add them to an ArrayList:我会将它们添加到 ArrayList 中:

String sitePrefix= "https://";
ArrayList photoArrayFemale = new ArrayList();
photoArrayFemale.add(...); //for each item in the Storage

From what I can tell, storageRefFemale.getDownloadUrl() only returns one value.据我所知, storageRefFemale.getDownloadUrl() 只返回一个值。 Please advise and please let me know if I should add anything else to the post.请告知,如果我应该在帖子中添加任何其他内容,请告诉我。 Thank you!谢谢!

storageRef.listAll().addOnSuccessListener(
    new OnSuccessListener<ListResult>() {
        @Override
        public void onSuccess(ListResult result) {
            // Iterate over result.items and get the URLs individually.
        }
    }
);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM