How To Add Image From Sql Database Into Recyclerview
I want to display a Recipe photo from my SQL Database into my RecyclerView. I declared as String the photo variable in my Recipe class: public class Recipe { private String title;
Solution 1:
Try showing image in imageview using Glide library this way
add this in your gradle file
implementation 'com.github.bumptech.glide:glide:4.8.0'
Replace this line in onBindViewHolder
viewHolder.imageView.setImageResource(Integer.parseInt(recipeList.get(position).getPhoto()));
with
Glide.with(mContext)
.load(recipeList.get(position).getPhoto())
.apply(RequestOptions.diskCacheStrategyOf(DiskCacheStrategy.ALL))
.apply(RequestOptions.noAnimation())
// .centerCrop().thumbnail(0.3f)
.into(viewHolder.imageView);
Post a Comment for "How To Add Image From Sql Database Into Recyclerview"