Android: perfectly solves the conflict between setonitemclicklistener and setontouchlistener of listview.
@ Overridepublic boolean onTouch (View v, MotionEvent event) {createVelocityTracker (event); switch (event. getAction () {case MotionEvent. ACTION_DOWN: xDown = event. getRawX (); break; case MotionEvent. ACTION_MOVE: xMove = event. getRawX (); // The distance from the activity to int distanceX = (int) (xMove-xDown); // you can call this operation to obtain the int xSpeed = getScrollVelocity (); // when the sliding distance is greater than our set minimum distance and the instantaneous sliding speed is greater than our set speed, return to the previous activityif (distanceX> XDISTANCE_MIN & xSpeed> XSPEED_MIN) {finish (); // set the switchover animation, which is displayed on the right and exits on the left. // overridePendingTransition (R. anim. in_from_left, R. anim. out_to_right);} else {return false;} break; case MotionEvent. ACTION_UP: recycleVelocityTracker (); break; default: break;} return false; // return false to respond to the click Event}
At the end, return false to respond to the click event, which perfectly resolves the event conflict issue !!!!!