I want to load data when ScrollView reach at the threshold. First, I want to show last 20 rows from database and show in ListView then after using SwipeRefreshLayout load another 20 rows get from database and show in ListView and so on...
Thank you
What you are searching for is called EndlessScrollListener. You will have to extend the class EndlessScrollListener and implement the onLoadMore method.
public class MyEndlessScrollListener extends EndlessScrollListener {
@Override
public void onLoadMore(int page, int totalItemsCount) {
loadData(page);
}
}
And set the listener on the listView :
listView.setOnScrollListener(new EndlessScrollListener());
You can use the other constructors of the EndlessScrollListener if you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With