Android. Download images to the list. Why is this happening and how to fix it?

There is a list with images. Code of adapter:
public class InventoryAdapter extends RecyclerView.Adapter<inventoryadapter.holder> {

 public static final String TAG = "InventoryAdapter";

 private ImageLoader imageLoader;
 private JSONArray data;

 public InventoryAdapter(ImageLoader imageLoader, JSONArray data) {
 this.imageLoader = imageLoader;
 this.data = data;
}

@Override
 public Holder onCreateViewHolder(ViewGroup parent, int viewType) {
 View View = LayoutInflater.from(parent.getContext())
 .inflate(R. layout.inventory_list_item, parent, false);
 Holder holder = new Holder(view);
 holder.image = (ImageView) view.findViewById(R. id.inventory_item_image);
 return holder;
}

@Override
 public void onBindViewHolder(final Holder holder, int position) {
 try {
 JSONObject item = data.getJSONObject(position);
 final String uri = "https://steamcommunity-a.akamaihd.net/economy/image/class/730/"
 + item.getString("classid") + "/70fx70f";
 imageLoader.loadImage(uri, new SimpleImageLoadingListener() {
@Override
 public void onLoadingComplete(String imageUri, View View, Bitmap loadedImage) {
holder.image.setImageBitmap(loadedImage);
}
});
 } catch (JSONException e) {
e.printStackTrace();
}
}

@Override
 public int getItemCount() {
 return data.length();
}

 public static class Holder extends RecyclerView.ViewHolder {
 public ImageView image;
 public Holder(View itemView) {
super(itemView);
}
}

}</inventoryadapter.holder>

The problem is visible in the GIF (image replaced during scrolling):
dad325aa07b34ffcb6c5a0018492db3a.gif
To load images use this library: https://github.com/nostra13/Android-Universal-Imag...
July 9th 19 at 10:21
2 answers
July 9th 19 at 10:23
Solution
This is due to the fact that unnecessary (the ones that scrolled off the screen) images are placed in reusable view function. What to do - throw UIL(don't like him), take a normal Glide or Picasso.
Another option - tag in the ImageView to remember the last requested url, it well to remember in College, compare, and, if they do not match, the image does not install.
IMHO, the first variant is better.
What's wrong with this loader? - brando commented on July 9th 19 at 10:26
: well the fact that you have additional gestures to make that you came here. And he's old as shit of a mammoth. - Art_Christians commented on July 9th 19 at 10:29
July 9th 19 at 10:25
Solution
A request to download images using image-loader does not work out instantly, so you and there is a small gap between the request to download and render the new image. I this library is not used, so there are two options:
1. Not connected or not configured with a cache, so images are always loaded to or from the network or from disk-cache, bypassing the in-memory cache.
2. With cache everything is fine, just for some reason the loader does not manage to do so quickly to changing images was imperceptible. Before downloading a new image or remove the image from ImageView: imageView.setImageResource(0);or install placeholder.

Find more questions by tags Android