2

I have a listview in which images gets downloaded when I scroll so whatever I have understand till now is the element which are visible only that element's images gets downloaded. Suppose only 7 elements are visible at a time and when I Scroll previous views are recycled with the new once so what happens to the process which was downloading the image of the previous views is it also cancelled or it queues the new request of downloading images of the new Views.I am asking about the process that queueing of process happens or the process which are not completed yet are cancelled. with process I mean downloading images in background

4
  • @chintan-rathod I am asking that if views are recycled does the process also gets killed. Commented Jan 25, 2016 at 11:06
  • Depend upon logic. Otherwise NO. Commented Jan 25, 2016 at 11:11
  • So do you know any way where i can stop the previous process for the views which hoes out of the screen or which are recycled? Commented Jan 25, 2016 at 11:13
  • Nope.. I have not heard regarding how to get update when view get disappeared from list.. Commented Jan 25, 2016 at 11:26

3 Answers 3

1

Depends completely on how you are downloading and caching the images.

If you are using AyncTasks to download your images and not cancelling them as you scroll then the image will be downloaded. If you are using libraries like volley/picasso/glide to handle your images then they cancel or cache the images depending on how much of the image was downloaded.

Sign up to request clarification or add additional context in comments.

5 Comments

so suppose I am using AsyncTask when i scrolled faster and lands on 60th element so do i have to wait till all images till 60th downloaded to see my image of 60th element?
Yes. How AsyncTasks behave is that internally it will only launch a limited number of threads after which all requests start going to a queue and all those requests will then be handled sequentially. To avoid this, dont start async tasks until your list has stopped scrolling.
Then how would I know that list has stopped scrolling?
By implementing an OnScrollListener
Yupp I'll implement your suggested method and if it solves I'll accept it.
1

Why don't you use Glide or Picasso or UIL for Lazy loading of images. Instead of downloading you can get the bitmap and save them as per your need.

1 Comment

Yeah I'll Surely try these libraries. Thanks
0

It was better that put your code here , but I think if you download image asynchronously, your problem is solved. you can download image in back ground by using "dispatch_async()" method.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.