1

I have made an extended Gallery class that uses small thumbnail images to allow for fast, low-memory scrolling and then loads in higher-resolution ones when the Gallery has stopped moving. I was previously populating the larger images into the Gallery as soon as I got them but this caused the stutter problem described in

android gallery view "stutters" with deferred image loading adapter

So now the Gallery calls setCallbackDuringFling(false); on construction and I repopulate from the onItemSelected(...) method. Unfortunately this means nothing happens till the Gallery stops moving, which can take quite a long time owing to what I assume are the exponential decay physics of the fling method. In particular, if a user halts the Gallery it seems intuitive to me that the Gallery should snap to its selected position quite quickly, ideally in a time proportional to how far off centre it is when released.

Is it possible to force the onItemSelected event to occur faster? I would use setSelection but for obvious reasons I don't know what position value to choose because none has been returned by the Gallery!

Community
  • 1
  • 1
Andrew Wyld
  • 7,133
  • 7
  • 54
  • 96
  • There seems to be no way to do this, so instead I added code to the subsidiary views to stop them changing while the Gallery is in motion, and used the `Gallery#getFirstVisiblePosition()` and `Gallery#getLastVisiblePosition()` methods to work out what to populate and when. Not ideal but it works. – Andrew Wyld Oct 14 '11 at 16:58

0 Answers0