想要列出firebase存储的子级中的所有文件,并共享ArrayList以将其设置在android应用程序的回收器视图中



在我的firebase存储中,我有一个子文件夹,它包含子文件夹,在这些文件夹中,有些包含文件,有些包含数据,我想列出所有文件夹中的所有数据。并将其传递给回收商View。

我想你想做这样的事情:

FirebaseStorage storage = FirebaseStorage.getInstance();
StorageReference listRef = storage.getReference().child("Wallpapers");
listRef.listAll()
.addOnSuccessListener(listResult -> {
// All the items under listRef.
images.addAll(listResult.getItems());
adapter.notifyDataSetChanged();
//....
})
.addOnFailureListener(e -> {
// Uh-oh, an error occurred!
Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
//...
});

编辑:图像是一个ArrayList对象,如下所示:

private ArrayList<StorageReference> images;

最新更新