Issue
I am working on an application where i am uploading multiple images with 4 edittexts to the firebase then I am trying to retrieve the data to the recyclerview now my editext's data is retrieving but the data of images is not showing in reyclerview.
@Override
public void onBindViewHolder(@NonNull Viewholder holder, int position)
{
holder.name.setText(datalist.get(position).getName());
holder.email.setText(datalist.get(position).getEmail());
holder.desc.setText(datalist.get(position).getDesc());
holder.book.setText(datalist.get(position).getBook());
Glide.with(context).load(datalist.get(position).getImage())
.into(holder.imageView);
}
@Override
public int getItemCount() {
return datalist.size();
}
public class Viewholder extends RecyclerView.ViewHolder{
TextView name, email, desc, book;
ImageView imageView;
public Viewholder(@NonNull View itemView) {
super(itemView);
name = itemView.findViewById(R.id.text_name);
email = itemView.findViewById(R.id.text_email);
desc = itemView.findViewById(R.id.text_desc);
book = itemView.findViewById(R.id.text_book);
imageView = itemView.findViewById(R.id.imageView3);
}
}
Solution
In the comment session you mentioned, getImage() is an array then, How it will load the image you need to pass a particular image in the array?
Let's suppose, If you want to load the first image in an array use the below code -
if(!wishlist_models.get(position).getImage().isEmpty()) {
Glide.with(context)
.load(wishlist_models.get(position).getImage()get(0))
.into(holder.wishlist_image);
}
Answered By - Aditya Nandardhane
Answer Checked By - Timothy Miller (JavaFixing Admin)