I am trying to know when the user has scrolled to the top or bottom of the listview and he cannot scroll anymore.
Now i'm using OnScrollListener to know what listview items are visible.
listview.setOnScrollListener(new OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
if (scrollState == OnScrollListener.SCROLL_STATE_IDLE) {
}
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
if (totalItemCount - visibleItemCount == firstVisibleItem) {
//last item visible
}
if (firstVisibleItem == 0) {
//first item visible
}
}
});