This seems a question with many answers already; however, I can\'t find a common approach to this.
I\'m trying to add data to a ListView
when the bottom is reac
Here's some code for my suggested third approach, which I use in my own projects. I use the adapter's getView
method to detect when the end of the list has been reached.
public View getView(int position, View convertView, ViewGroup parent) {
// handle recycling/creating/initializing view
if(reachedEndOfList(position)) loadMoreData();
return convertView;
}
private boolean reachedEndOfList(int position) {
// can check if close or exactly at the end
return position == getSize() - 1;
}
private void loadMoreData() {
// Perhaps set flag to indicate you're loading and check flag before proceeding with AsyncTask or whatever
}