I was recently playing a little bit with the RecyclerView and the concept of ViewHolder's in Android 5+. The adapter implementation handles quite a large dataset (i.e ~ 60 000 items), requested from the internet upon onBindViewHolder(...) call. The network requests are handled by the volley library and the response represents the data model used to fill up the view holder.
Now when fast-flinging (i.e motion with a velocity, different than swipe where a user touches the device and moves slowly across the screen) the onBindViewHolder is called for all positions in the adapter, which is not a good thing as most of the viewholders can't be visible due to high speed of the animation. For example, if user swipes from position 5 to 300 in a matter of seconds most of the views can't be readable, yet the bind method is called. Since the adapter gets the data model from the network - a lot of requests are made, most of them are of no use, and the hole process just delays the processing of requests around position 300 which is the one that user can realy observe.
How would one approach this issue of requesting only the visible positions? My first approach was to prioritize the requests in the volley processing queue. This really didn't solve much of the problem since every network request is processed just in a different order. My second approach was to cancel all existing requests when a new one is added. It didn't work for me really well and from a design point of view I don't like this solution.
My real question is then, how would you approach this issue?