It is necessary before the bind to somehow load the images so that there is no slowdown in loading

public void onBindViewHolder(ViewHolder holder, int position) { Product product = Products.get(position); if (position < Products.size() - 2 ){ Picasso.with(contexts).load(BitmapUrlHelper.getPictureUrl(contexts, Products.get(position + 1).getImage(), 80)) .fetch(); } if (position > 0 ){ Picasso.with(contexts).load(BitmapUrlHelper.getPictureUrl(contexts, Products.get(position - 1).getImage(), 80)) .fetch(); } if (product.getImage_preview_android() == null){ setBackground(product.getImage(), holder.background_view, true) } else setBackground(product.getImage_preview_android(), holder.background_view,false); } private void setBackground(String imageUrl, ImageView background, boolean croped) { Picasso.with(contexts).setIndicatorsEnabled(false); if (croped) Picasso.with(contexts) .load(BitmapUrlHelper.getPictureUrl(contexts, imageUrl, 80)).centerInside().resize(((displayWidth) - 10), (Integer) ((displayHigh) / 5)).placeholder(R.drawable.cart) .into(background); // loadBackgroundImage(background,BitmapUrlHelper.getPictureUrl(contexts, imageUrl, 80),((displayWidth) - 10), (Integer) ((displayHigh) / 5)); else { Picasso.with(contexts) .load(BitmapUrlHelper.getPictureUrl(contexts, imageUrl, 80)).fit() .into(background); } } 
  • Well, and Picasso is able to get a link from the cache? And if so, then it may be necessary to indicate this to him somehow? - JuriySPb
  • can, just how? - Denis
  • Well, in the documentation, probably, something is written about this ... - YuriySPb

1 answer 1

You need to add a blank placeHolder image, with the size of the loaded image. Fight like this:

 Picasso.with(contexts).load(BitmapUrlHelper.getPictureUrl(contexts, Products.get(position + 1).getImage(), 80)). .placeholder(R.drawable.image_place_holder)fetch(); image_place_holder - собсна свою картину только выбирете 
  • Will it increase upload speed? - Denis
  • speed - no way - Android Android
  • just picasso every time for some reason takes downloads pictures from an Internet, although they are in the cache. - Denis
  • It’s just hard to get into your code, I thought the problem was in pulling the list - Android Android
  • This is simply inserting an image in the onBindViewHolder method of the class RecyclerView.Adapter <ViewHolder> - Denis