Glide: Glide will reload a error url when the activity onResume

Created on 14 Feb 2017  路  2Comments  路  Source: bumptech/glide

Glide Version: 3.7.0

Device/Android Version: SM801 / 5.1.1

Issue details / Use case background:

Glide set a default error image when load failed.
But when I start another Activity and back to the previous Activity锛宼he ImageView which loaded the error image will retry to load the url. And it will failed again, then set the default error image again.
This twinkling animation is not suitable.
I don't want to auto reload the url which had load failed.
How should I do ?

Glide load line:

I use Glide in RecyclerView.Adapter.

protected void onBindViewHolder(@NonNull ViewHolder holder, @NonNull final Topic topic) {
    Glide.with(holder.avatar.getContext())
        .load(topic.getUser().getAvatarUrl())
        .error(R.mipmap.ic_avatar_error)
        .crossFade()
        .into(holder.avatar);
}

screen recording:
Please notice the avatar of "luhaoaimama1",

  1. all avatars had loaded;
  2. I press the home key;
  3. I reopen the app;
  4. these avatar which had loaded the default error image reload once by twinkling.

tmpdir--17_2_14_13_17_56

question

Most helpful comment

Follow your advice锛宼hese avatar would not twinkle. Thank you very much.

But is there a function to prevent Glide to reload a picture which had load failed before ?

All 2 comments

Would it work for you if you added .placeholder(R.mipmap.ic_avatar_error)? Theoretically it should fix the problem, however it will change the behavior the first time any profile image is shown. Give it a spin and let me know.

Follow your advice锛宼hese avatar would not twinkle. Thank you very much.

But is there a function to prevent Glide to reload a picture which had load failed before ?

Was this page helpful?
0 / 5 - 0 ratings