Skip to content Skip to sidebar Skip to footer

Image Not Loading With Picasso Or Glide..keeps Displaying Black Background

I'm trying to load an image from firebase database using picasso, but no matter what I try it keeps doing the same thing ... I even tried using glide Here's what's happening when

Solution 1:

When you use the following line

finalStringdownloadUrl= filePath.getDownloadUrl().toString();

filePath.getDownloadUrl() returns the task ID (com.google.android.gms.tasks.zzu@f30b587) which you then save to the database instead of the actual url , so when you use the following line to get the url (to load the image in via picasso) you are just getting the upload id! No a usable url.

String image = dataSnapshot.child("profileimage").getValue(String.class);

To fix this you need to get the download url in an async task after firebase storage upload. As per https://firebase.google.com/docs/storage/android/upload-files#get_a_download_url

Then add the actual url to the firebase database which links the database to the stored image :) I'm sure there a more elegant method but this works.

Post a Comment for "Image Not Loading With Picasso Or Glide..keeps Displaying Black Background"