I'm trying to get a Firebase Image into a RecyclerView, and, as my method works only with this type of link:
I was trying to get that link for each image with this code:
FirebaseRecyclerAdapter<Viaje,ListaViajes.MyHolder> firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<Viaje, MyHolder>(options) {
@Override
protected void onBindViewHolder(@NonNull final MyHolder holder, int position, @NonNull Viaje model) {
storageReference = FirebaseStorage.getInstance().getReference();
StorageReference pathRef = storageReference.child("images").child(model.getUserName()+".jpeg");
holder.setSitio(model.getSitio().toString());
holder.setPruebaImagen(pathRef.getDownloadUrl().toString());
});
}
MyHolder class with my "custom method" (it works well with handed typed urls)
public static class MyHolder extends RecyclerView.ViewHolder{
View mView;
public MyHolder(View itemView)
{
super(itemView);
mView=itemView;
}
public void setPruebaImagen(String url)
{
ImageView imageView = mView.findViewById(R.id.image_view);
GlideUtil.loadProfilePhoto(url,imageView );
}
}
The images are located in a folder called images and are named by the user's username, that's why I do the call model.getUserName()
The problem is, no image is actually shown.
The storageReference works fike I think, as it gets the value gs://benaluma-1522696560348.appspot.com/
, however from then on, I'm lost, maybe it's just a matter of the .child methods syntaxis or the .getDownloadUrl
method, thanks in advance