1

I have a populated ListView with custom adapter and my objective is to download new content when user scrolls to the end of it ? How to achieve it ? I think it should be something in here :

        mListView.setOnScrollListener(new OnScrollListener() {
        @Override
        public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
        // TODO Auto-generated method stub

        }

        @Override
        public void onScrollStateChanged(AbsListView view, int scrollState) {
            // TODO Auto-generated method stub

        }
    });

but I don't know what exactly to put there.Please help.

2 Answers2

0

First have a look here . What I would recommend is putting this in your onScroll :

if (++firstVisibleItem + visibleItemCount > totalItemCount) {
    // do whatever you want here

}

Hope this is what you're looking for.

Community
  • 1
  • 1
slezadav
  • 6,104
  • 7
  • 40
  • 61
0

Did you check CommonsWare's Endless Adapter? Check this out. It might solve your problem.

Thiago M Rocha
  • 1,416
  • 1
  • 20
  • 26