I have a gallery view created using the SimpleAdapter that extends the BaseAdapter. It contains more items than what can fit on the screen.
Therefore, I use Gallery.getFirstVisiblePosition()both Gallery.getLastVisiblePosition()to get the first and last visible position. But these functions do not always return the correct values, especially after setting the selected position, calling mGallery.setSelection(), and then calling SimpleAdapter.notifyDataChanged(). Most of the time it getFirstVisiblePosition()returns 0, even if the first item is not displayed.
Also note that no. visible elements in the Gallery are different in portrait and landscape modes. The value returned getFirstVisiblePosition()looks correct in the landscape, but returns in portrait mode.
Anyone have any thoughts / ideas?
Thank!
source
share