使用 Firebase 存储文件夹中的图像填充数组

populating array with images from a Firebase storage folder

所以我设法让我的 Android 应用程序与 Firebase 和 Glide 一起工作,并且我能够将单个图像从 Firebase 加载到 ImageView 中,如下所示:

imageview1;

imageview1 = (ImageView)findViewById(R.id.ivTest);
String url1 = "https://firebasestorage.googleapis.com/v0/b/zxtrix-e017d.appspot.com/o/fullsize%2Falligator.jpg?alt=media&token=1b85f1c4-4133-41d8-a65f-eg2e263g0403";
Glide.with(getApplicationContext())
     .load(url1)
     .into(imageview1);

但是,我目前正像这样从我的 /res/ 文件夹中加载图像数组,我想更改它以便它从 Firebase 加载。

Integer[] ApocImages =  {R.drawable.image1, R.drawable.image2, R.drawable.image3, R.drawable.image4,
        R.drawable.image5, R.drawable.image6, R.drawable.image7, R.drawable.image8,
        R.drawable.image9, R.drawable.image10, R.drawable.image11, R.drawable.image12,
        R.drawable.image13, R.drawable.image14, R.drawable.image15, R.drawable.image16};

我已经将 /res/ 文件夹中的所有图片上传到我的 Firebase 应用程序存储区。

我现在如何将它们从 Firebase 加载到我的数组中?

谢谢!

您可以制作一个 URL 的数组,与您制作的 drawable 相同。

String[] url =  {"https://firebasestorage.googleapis.com/v0/b/zxtrix-e017d.appspot.com/o/fullsize%2Falligator.jpg?alt=media&token=1b85f1c4-4133-41d8-a65f-eg2e263g0403",
"https://firebasestorage.googleapis.com/v0/b/zxtrix-e017d.appspot.com/o/fullsize%2Falligator.jpg?alt=media&token=1b85f1c4-4133-41d8-a65f-eg2e263g0403",
"https://firebasestorage.googleapis.com/v0/b/zxtrix-e017d.appspot.com/o/fullsize%2Falligator.jpg?alt=media&token=1b85f1c4-4133-41d8-a65f-eg2e263g0403"}; 

之后,设置for循环

for (int i=0; i<url.size; i++) {
    Glide.with(getApplicationContext())
         .load(url.get(i))
         .into(imageview1);
}