-
-
Save gbaldera/7665007 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EndlessScrollListener implements OnScrollListener { | |
private int visibleThreshold = 20; | |
private int currentPage = 0; | |
@Override | |
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { | |
} | |
@Override | |
public void onScrollStateChanged(AbsListView view, int scrollState) { | |
if (scrollState == SCROLL_STATE_IDLE) { | |
if (listView.getLastVisiblePosition() >= listView.getCount() - visibleThreshold) { | |
currentPage++; | |
downloadRecordsTask.setPage(currentPage); | |
downloadRecordsTask.execute(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment