Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Storage and Android images

So I want to basically get an image from Firebase storage (I have rules set to public).

This is what I have

    ImageView image = (ImageView)findViewById(R.id.imageView);
    Glide.with(this)
    .load("https://firebasestorage.googleapis.com/v0/b/test-7c916.appspot.com/o/images.jpg?alt=media&token=b207cb11-9ad5-48e3-86ac-1dcb07ee6013")
    .into(image);

And I instead of using an https link. I want to use a storage reference. But everytime I try to use a storage reference my app crashes. Please help.

Like the .child() method.

like image 872
Alexei Sapozhnikov Avatar asked Sep 07 '25 02:09

Alexei Sapozhnikov


1 Answers

You need to use StorageReference to load Firebase storage image.

   // Reference to an image file in Cloud Storage
StorageReference storageReference = = FirebaseStorage.getInstance().getReference().child("myimage");


ImageView image = (ImageView)findViewById(R.id.imageView);

// Load the image using Glide
Glide.with(this /* context */)
        .using(new FirebaseImageLoader())
        .load(storageReference)
        .into(image );

For more details You can check Using FirebaseUI to download and display images.

like image 81
pRaNaY Avatar answered Sep 08 '25 23:09

pRaNaY