Как получить все ваши элементы хранения firebase с помощью метода 'listall ()'?
i know the documentation do it like this listRef.listAll() .addOnSuccessListener(new OnSuccessListener<ListResult>() { @Override public void onSuccess(ListResult listResult) { for (StorageReference prefix : listResult.getPrefixes()) { // All the prefixes under listRef. // You may call listAll() recursively on them. } for (StorageReference item : listResult.getItems()) { // All the items under listRef. } } })
но как я могу получить свои данные из элемента? например uri изображения или метаданные
public class Wallpaper { private String wallpaperName; private Uri imageUri; public Wallpaper(String wallpaperName, Uri imageUri) { this.wallpaperName = wallpaperName; this.imageUri = imageUri; } public Wallpaper() { } public String getWallpaperName() { return wallpaperName; } public void setWallpaperName(String wallpaperName) { this.wallpaperName = wallpaperName; } public Uri getImageUri() { return imageUri; } public void setImageUri(Uri imageUri) { this.imageUri = imageUri; } } public class ShowWallpapers extends AppCompatActivity { private RecyclerView recyclerView; private RecyclerViewAdapter recyclerViewAdapter; private List<Wallpaper> wallpaperList; private StorageReference storageReference; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_show_wallpapers); storageReference = FirebaseStorage.getInstance().getReference("wallpapers"); recyclerView = findViewById(R.id.recyclerview); recyclerView.setHasFixedSize(true); recyclerView.setLayoutManager(new LinearLayoutManager(this)); wallpaperList = new ArrayList<>(); storageReference.listAll() .addOnSuccessListener(new OnSuccessListener<ListResult>() { @Override public void onSuccess(ListResult listResult) { for (StorageReference item : listResult.getItems()) { // i want to set-up my Wallpaper object here and add it to my list // but how can i do that } recyclerViewAdapter = new RecyclerViewAdapter(ShowWallpapers.this, wallpaperList); recyclerView.setAdapter(recyclerViewAdapter); } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { } }); } }
мое хранилище: https://i.imgur.com/jnjW6Ko.png[^]
Что я уже пробовал:
Я ничего не мог предпринять.