I faced with problem, when I can not detect action down event.I want implement pull-to-refresh to the listview as in the link: http://www.javacodegeeks.com/2013/06/android-listview-pull-to-refresh.html.
@Override
public boolean onTouchEvent(MotionEvent event) {
//System.out.println("First ["+this.getFirstVisiblePosition()+"]");
float y = event.getY();
switch (event.getAction()) {
case MotionEvent.ACTION_MOVE: {
Log.d(LOG_TAG, "MOVE");
if ( ( y - startY) > THRESHOLD && STATE_REFRESH_ENABLED && !STATE_REFRESHING ) {
}
}
break;
case MotionEvent.ACTION_DOWN: {
Log.d(LOG_TAG, "DOWN");
startY = y;
STATE_REFRESH_ENABLED = getFirstVisiblePosition() == 0; // We are on the first element so we can enable refresh
}
case MotionEvent.ACTION_UP: {
Log.d(LOG_TAG, "UP");
STATE_REFRESHING = false;
}
}
return super.onTouchEvent(event);
}
According to log down acion is not detected. Thanks in advance.