There is a RecyclerView with publications (there is an ImageView in the view of these publications). For example, I downloaded 100 publications from the Internet and for each, using Picasso, the library loads pictures into ImageView.
Picasso.with(context).load(url).placeholder(placeholderImage).error(errorImage).into(ImageView); So the problem is that in the first 7-10 publications the images are loaded and the rest are also placeholderImage. There is a catch that this is due to the fact that if the not yet loaded ImageView goes to the RecyclerView cache, then it still remains a placeholderImage. But I do not know because of what exactly and how to solve?
Vota adapter code:
public class RecAdapter extends RecyclerView.Adapter<RecAdapter.ViewHolder> { private ArrayList<Data_Publication> data; private LayoutInflater inflater; private Context context; private Callback callback; public RecAdapter(Context context , ArrayList<Data_Publication> data_list , Callback callback){ this.context = context; this.data = data_list; this.inflater = LayoutInflater.from(context); this.callback = callback; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = inflater.inflate(R.layout.publication, parent , false); return new ViewHolder(view); } @Override public void onBindViewHolder(ViewHolder holder, int position) { Data_Publication pub = data.get(position); holder.setName(pub.getProduct_name()); holder.setPrice(pub.getProduct_price()); holder.setLocation(pub.getProduct_locaton()); holder.setClicker(pub.getProduct_id() , pub.getProduct_name()); holder.loadImage(pub.getPhotoStroge().concat(pub.getImage_url())); } @Override public int getItemCount() { return data.size(); } public class ViewHolder extends RecyclerView.ViewHolder{ final private TextView name; final private TextView price; final private TextView location; final private ImageView image; final private LinearLayout content; final private LinearLayout main; private ViewHolder(View view) { super(view); this.name = (TextView) view.findViewById(R.id.pub_name); this.price = (TextView) view.findViewById(R.id.pub_price); this.location = (TextView) view.findViewById(R.id.pub_location); this.image = (ImageView) view.findViewById(R.id.pub_image); this.content = (LinearLayout) view.findViewById(R.id.pub_content); this.main = (LinearLayout) view.findViewById(R.id.pub_main); } public void setName(String name) { this.name.setText(name); } public void setPrice(String price) { this.price.setText(price); } public void setLocation(String location){ this.location.setText(location); } public void loadImage(String url){ Picasso.with(context).load(url).placeholder(R.drawable.placeholder).error(R.drawable.error_ph).into(this.image); } public void setClicker(final String id , final String name){ final Animation anim = AnimationUtils.loadAnimation(context, R.anim.move_left); content.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { main.startAnimation(anim); callback.operation(id , name); } }); } } }