Search code examples
androidbuttoncallbackgalleryonfling

Buttons scrolling the gallery


In my application I have a Gallery view and two buttons to scroll it - left and right. Scrolling the gallery by fling also works, and here is the problem: how can I update the states of buttons after the user scrolled the Gallery using fling movements? Is there any callback that tells that Gallery's selected item has changed? Thanks.


Solution

  • There is an onItemSelectedListener that you can use with a gallery. If you use it you'll probably also want to read about setCallbackDuringFling() that can enable/disable the listener while flinging.