I have got list that is filled with data from internet.
Datas are downloaded in chunks. At the end of the list next portion of data is downloaded and added to the list.
I'm detecting list end with help of onScrollListner:
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
if (view.getAdapter() != null && ((firstVisibleItem + visibleItemCount) >= totalItemCount) && totalItemCount != mPrevTotalItemCount) {
Log.v(TAG, "onListEnd, extending list");
mPrevTotalItemCount = totalItemCount;
addMoreData();
}
}
I would like to addLoading...
row when datas are being downloaded. Something similar to Gmail loading row at the end of the list.
I know that I can hack adapter.getCount()
to return size + 1 and force adapter.getView
to display loading... at the end of the list.
How can I do that in more elegant way?