1

I'm trying to get a Firebase Image into a RecyclerView, and, as my method works only with this type of link:enter image description here

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()

enter image description here

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

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
Kevin M.
  • 152
  • 2
  • 14
  • You can't just call toString() on the Task returned by getDownloadURL. Read the dup issue for details on how it works. – Doug Stevenson Jul 17 '18 at 21:21
  • What is dup issue? Sorry I'm new with Android developing. I can see it's a task, I have to wait for it to complete and then use the result with a string format? – Kevin M. Jul 18 '18 at 14:31
  • If you want to use getDownloadURL correctly, follow the instructions in the answer in the other question. – Doug Stevenson Jul 18 '18 at 14:37
  • Problem is, I don't know how to manage the URL then, with my GlideUtil method that receives a string as parameter, what should I put into it, the getResult().toString()? – Kevin M. Jul 18 '18 at 14:42

0 Answers0