Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How does Picasso solve the image mismatch issue #1675

Closed
gongzelong0718 opened this issue Sep 28, 2017 · 1 comment
Closed

How does Picasso solve the image mismatch issue #1675

gongzelong0718 opened this issue Sep 28, 2017 · 1 comment

Comments

@gongzelong0718
Copy link

gongzelong0718 commented Sep 28, 2017

I notice the comments @JakeWharton wrote in the previous issue.

#83

But only if you are not in a list/grid adapter! Requesting an image for the same imageview/target (e.g., in an adapter getView) will do this automatically. You should only need to cancel (and you don't actually need to) if you're making requests and then leaving the screen.

#1302

Picasso keeps a map of ImageView -> URL and when the same ImageView is seen twice, the loading of the original URL is canceled and and new one is started.

I have read the source codes but I think I did not get it totally.

Picasso automatically sees when views are being re-used and will cancel old downloads for that image view

My question is how the logic above is written in the codes? What are the related codes?

@JakeWharton
Copy link
Member

The code is in Dispatcher. You can follow either the into method on RequestCreator or the cancel method on Picasso to see what it does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants