I want to load images I have in my recyclerview after 350ms and I think I'm using wrong method for that. This is my code:
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
holder.songView.setText(objects_.get(position).getAlbum());
holder.artistView.setText(objects_.get(position).getArtist());
holder.cover.setImageResource(R.drawable.song);
r = new Ruable() {
public void run() {
Drawable img = Drawable.createFromPath(objects_.get(holder.getAdapterPosition()).getCover());
if (img != null) {
holder.cover.setImageDrawable(img);
}
}
};
handler.postDelayed(r, 350);
}
But I have a problem with this. when I fast scroll recyclerview images of previous items loads at first then changes to new items picture. You can see result in GIF from this link:
http://8pic.ir/images/nkaaeqdvigqy4c6g2h5n.gif
what can I do to fix it?
