I have a Gallery view created with a SimpleAdapter that extends BaseAdapter. It contains more items than what it can fit in the screen.
So I'm using Gallery.getFirstVisiblePosition() and Gallery.getLastVisiblePosition() to get the first and last visible position. But these functions doesn't always return the correct values especially after setting the selected position by calling mGallery.setSelection() followed by a SimpleAdapter.notifyDataChanged() call. Most of the time it getFirstVisiblePosition() returns 0 even if the first element is not visible.
Also note that the no. of visible items in Gallery is different in portrait and landscape mode. The value returned by getFirstVisiblePosition() look correct in landscape but is returned wrong in portrait mode.
Anyone has any thoughts/ideas?
Thanks!