Learning how to use the OnScrollListener and I want to make a way I can detect everytime a new List item is visible when a user scrolls up or down in a listview, if the user scrolls down I want to make a counter increment by 1 for each new cell that enters the screen and if it scrolls up I want it to decrement, any help would go a long way, thanks.
counter = 0;
list.setOnScrollListener(new OnScrollListener() {
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
// If list scroll up
counter++;
// If list scrolls down
counter--;
}
});