I have a listview which contains N no. of items. When user scroll down the list and reached to the last. I want to know when user is in the last row of the list. How to know this?
I can use
onFocus
method, but don’t know how can i come to know that last row is focused?
If by focused you mean selected (scrolled down by the keyboard, has the selection rectangle around it) then just use setOnItemSelectedListener. The int argument is the position, compare that to the number of items in your list and you’re golden.
If by focused you mean visible, then use setOnScrollListener, which has this method:
Just first + visible will get the last item shown, which you can compare to the total.