In my firebase storage i have a child which contains subfolder and on these folder some contains files while some contains data, I want to list out all the data in all the folders. and pass it to recycler View.
Advertisement
Answer
I guess you want to do something like this:
JavaScript
x
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();
//...
});
Edit: images is an ArrayList object like this:
JavaScript
private ArrayList<StorageReference> images;