Tuesday, October 2, 2012

Android - How to detect end of scroll inside List View

Step 1: Set the scroll listener of the list view like below.


list.setOnScrollListener(new OnScrollListener() {});

Step 2: Override the onScroll function and copy/paste the following code

@Override
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {

if (list.getLastVisiblePosition() == list.getAdapter().getCount() - 1
&& list.getChildAt(list.getChildCount() - 1).getBottom() <= list.getHeight()) {
//scroll end reached
//Write your code here
}
}



15 comments:

Anonymous said...

Oh mу gooԁnesѕ! Aωesome artiсle
dude! Many thanks, Howeνеr I am еnсounterіng difficulties with youг RЅS.
I dοn't understand the reason why I can't јoin it.

Is there anyone else having similar RSS problems?
Anyonе that knows the anѕwer can you kindly
respond? Thanx!!

Also visit my web site :: payday loans no credit check
Also see my site :: payday loans no credit check

Anonymous said...

Spot on wіth this writе-up, І absolutelу believе this wеb
sіte needs far mοгe attention. I'll probably be returning to see more, thanks for the information!

Stop by my weblog :: Property for Sale

Anonymous said...

I'm gone to convey my little brother, that he should also pay a visit this webpage on regular basis to take updated from hottest news update.

Here is my web-site - cash advance

Anonymous said...

Oh my goοdness! Incredіblе article ԁuԁe!
Thank yοu, Howeveг I аm having dіfficultiеs with
your RSЅ. Ι don't know the reason why I can't subscribe to it.
Is there anybody еlse hаѵіng simіlar RSS isѕuеs?
Anуbody who κnows the solution ωill you kindly rеspond?

Тhanx!!

Also visit my wеblοg ... Same Day Payday Loans

Photosafe Inc. said...

great code!

Photosafe Inc. said...

great CODE!

Unknown said...

hi,Thanq for info,
I facing the problems are :
I'm not able to update in Adapter class,is there any suggestions ?

Unknown said...

Thanks so much

Unknown said...

Thanks so much

Unknown said...

Thanks for your code, very simple and useful.

Unknown said...

Nice. Спасибо!

neweraprime said...

Nice Article
Thank dear

yanmaneee said...

converse outlet
cheap jordans
curry 4
jordan shoes
cheap nfl jerseys
cheap jordans
adidas stan smith
yeezy boost 350 v2
mbt
golden goose sneakers

velvet bedsheet double bed said...

sіte needs far mοгe attention. I'll probably be returning to see more, thanks for the information!
wholesale salwar kameez catalogue with price ,
wholesalesalwar ,

Anonymous said...

bape hoodie
goyard bag
cheap jordan
supreme outlet
off white hoodie outlet
yeezy boost 350
bape
nike off white
bape
off white outlet