Is there a way to bypass the normal behavior of ViewPager
and its offscreen page limit?
My ViewPager
contains four fragments
, each containing a gridview
of images. The problem I have is that on instansiation of the ViewPager
, two fragments
are created, which results in that about 20 images (about 10 per fragment) is downloaded/fetched from catch simultaneously. Is it possible to disable the offscreen page limit?
My goal is to only download images when a fragment
is selected, or only when the user is hovering the image. One way to achieve this is to use the onPageSelected
listener and set a flag, which tells the GridViewAdapter
if it's allowed to download the image or not.
A second way that I can think of is to set a HoverListener
on the ImageView
, and only download the image on onHover
, but that listener is only available in 4.0 and later.
Is there a better way to achieve this?