Skip to content

Problem in loading images in android ViewPager from http urls with slow connection. #1261

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

Open
AggarwalAnkit opened this issue Jan 12, 2016 · 0 comments

Comments

@AggarwalAnkit
Copy link

I have a view pager in which fragments are loading dynamical (I am using FragmentStatePagerAdapter as there are a lot of fragments depending upon the number of images in the array of images). Each fragment contains an Image View. I am calling Picasso.with(mContext).load(url).into(imageView); it puts the request in a queue, and when I keep scrolling it keeps putting requests in queue. The problem is when internet connection is slow, previous requests take time and current image (on current page) is served after a long time and meanwhile screen shows place holder image. So, my question is ,is there any way to cancel requests made for previous fragments and just execute the current request? Also, at a time view pager is keeping 3 fragments in memory (default behaviour), so if other fragments (off screen fragments) are getting destroyed, does picasso cancel those requests (related to fragments which are getting destroyed) automatically? If these requests are not getting cancelled automatically, is there any way to do that?

I know there are functions to cancle requests but I don't know how to use them in case of view pager as view pager will keep atleast 3 fragments in memory by default.

I am using Picasso 2.4.0. I am not using Picasso 2.5.2 as it has issues in loading camera images (the bug is already locked regarding this camera image issue and I also haven't found any solution yet)

@JakeWharton Please help me to solve this problem

Thanks and regards

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

1 participant