I'm trying to load images stored in my Firestore storage to the image view with RecyclerView of Android. Uploading image is not a problem and I configured same permission for upload and download. But it only shows an image specified in the parameter of placeholder.
I searched several things which seem to be relevant with this issue. Then I found that the matter of the version of Picasso Library and change of with(context) to get()
.
I applied them to my code and tested.
with the version of Picasso for 2.5.2 then tried with(mContext).
Next I tried the version of Picasso for 2.71828 then tried get()
.
But both gives same result which can be confirmed here.
It seems to be this is not a matter of Picasso. But I couldn't find proper solution.
Anyone can help this out?
Source for onBindViewHolder
in an imageAdapter.java
@Override
public void onBindViewHolder(ImageViewHolder holder, int position) {
Upload uploadCurrent = mUploads.get(position);
holder.textViewName.setText(uploadCurrent.getName());
Picasso.with(mContext)
.load(uploadCurrent.getImageUrl())
.placeholder(R.mipmap.ic_launcher)
.fit()
.centerCrop()
.into(holder.imageView);
}
As I mentioned above, get()
replaced of with(mContext
) already tried.
Please let me know if you need further information for this.
you can use a callback to get success/error events.
Picasso.with(mContext)
.load(uploadCurrent.getImageUrl())
.error(R.drawable.error_image)
.into(holder.imageView, new com.squareup.picasso.Callback() {
@Override
public void onSuccess() {
// will load image
}
@Override
public void onError() {
// will not load image from url
}
});