onScroll gets called when I set listView.onScrollListener(this), but without any touch

Just a reminder, according to the javadoc of

MotionEvent.ACTION_SCROLL :

This action is always delivered to the window or view under the pointer, which may not be the window or view currently touched.

This action is not a touch event so it is delivered to onGenericMotionEvent(MotionEvent) rather than onTouchEvent(MotionEvent).

Hence, motionEvent.getAction() will never gets the SCROLL event. Check for MOVE will do the job

You can also do the similar thing in the onScrollStateChanged method of the OnScrollListener

@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
        if(scrollState == OnScrollListener.SCROLL_STATE_TOUCH_SCROLL){
            userScrolled = true;
        }   
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)