Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
254 views
in Technique[技术] by (71.8m points)

Android Java recycle View scrolling: will it redownload images?

I am using picasso in my recycler view. I am wondering about the caching: When I scroll down the images disappear and when I scroll up again, they show again. But its displaying the progress bar for downloading and it takes like a second to show it.

my code

                Picasso.get().load(profileUrl).placeholder(R.drawable.placeholder_image).fit().into(postViewHolder.profileImg);

I want to avoid downloading the same images multiple times. Or is it just the caching that takes some time to display the already cached image again?

question from:https://stackoverflow.com/questions/65887497/android-java-recycle-view-scrolling-will-it-redownload-images

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Picasso should cache images automatically. You can can check if it's cached by using the setIndicatorsEnabled method on the Picasso singleton instance.

  • Red: Downloading over the network.
  • Blue: Image was cached on disc.
  • Green: Image was cached in memory.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...