I want ot update my listView when I scroll down I do this :
mConnectionList.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
int action = event.getAction();
switch (action) {
case MotionEvent.ACTION_DOWN:
if( mConnectionList.getLastVisiblePosition() == connectionList.size()-1 ){
getConnections();
}
break;
case MotionEvent.ACTION_UP:
isCrollingDown.set(false);
break;
default:
}
return false;
}
});
But it does not work corretlly it update when I scroll down and update when I scroll up
Also I try do this but it doesn not work coretly too :
mConnectionList.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
}
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
// Log.e("a0","a " + mConnectionList.getLastVisiblePosition());
// if(mConnectionList.getLastVisiblePosition() == connectionList.size()-1 ){
getConnections();
}
}
});