So I managed to get my Android app working with both Firebase and Glide and I'm able to load a single image from Firebase into an ImageView like this:
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);
However, I'm currently loading an array of images from my /res/ folder like this, and I want to change it so that it loads from Firebase instead.
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};
I've uploaded all the images in my /res/ folder to my Firebase app storage area.
How can I now load them from Firebase into my array?
Thanks!
You can make an array of URL same as drawable you made.
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"};
After this, set for loop
for (int i=0; i<url.size; i++) {
Glide.with(getApplicationContext())
.load(url.get(i))
.into(imageview1);
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments