-1

So when I upload an image onto Firebase Storage, the getDownloadUrl() method generates a string such as: com.google.android.gms.tasks.zzu@275cc4

Now I'm trying to place the image uploaded into an ImageView:

ImageView img;

img = v.findViewById(R.id.imgView);

Glide.with(getApplicationContext()).load("com.google.android.gms.tasks.zzu@275cc4").into(img);

This doesn't seem to load the image. I tried with the full firebase url https://firebasestorage.googleapis.com/v0/..... and this worked, but I can't seem to find a method that generates this when I upload an image?

Zoe
  • 27,060
  • 21
  • 118
  • 148
compsciman
  • 349
  • 3
  • 17

2 Answers2

3
storageRef.child(path).getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
                    @Override
                    public void onSuccess(Uri uri) {
                        Glide.with(getApplicationContext()).load(uri.toString()).into(img);
                    }
                });

Hope this will help you.......Have a nice day

mayank modi
  • 129
  • 1
  • 4
  • ahh, you saved me, trying to learn firebase from some old but good free stuff, and almost everything is different as usual :) – Nenad Štrbić Aug 11 '20 at 22:47
2

To solve this, you need to pass to the load() method the actual url of the photo. I'm affraid:

com.google.android.gms.tasks.zzu@275cc4

Is not a valid url for an image. So change the above url with one that is correct formated and includes: https://firebasestorage.googleapis.com/v0/....

To verify if the url is correct, just copy and paste that url in a browser and see if it opens an image. If it doesn't open, it means that you have provided an incorrect url.

Alex Mamo
  • 130,605
  • 17
  • 163
  • 193
  • Is there a method that will get me the full `https` url? Or a way to manipulate that string into the correct one? – compsciman Oct 04 '18 at 17:09
  • Check **[this](https://stackoverflow.com/questions/50795091/cant-get-download-url-from-firebase-storge-in-android)** out. In this way you can get the download url. – Alex Mamo Oct 04 '18 at 17:14
  • Hi compsciman! Is there everything alright, have you solved the issue? – Alex Mamo Oct 05 '18 at 07:38