Code example for MotionEvent

Methods: getXgetY

0
 
			// if (e1.getPointerCount() > 1 || e2.getPointerCount() > 1) return 
			// false; 
			if (mScaleDetector != null && mScaleDetector.isInProgress()) return false;
 
			final float diffX = e2.getX() - e1.getX();
			final float diffY = e2.getY() - e1.getY();
 
			if (Math.abs(velocityX) > 800 || Math.abs(velocityY) > 800) {
				scrollBy(diffX / 2, diffY / 2, 300);
				invalidate(); 
			} 
			return super.onFling(e1, e2, velocityX, velocityY);
		} 
 
		@Override 
		public void onLongPress(final MotionEvent e) {
			if (isLongClickable()) { 
				if (mScaleDetector != null && !mScaleDetector.isInProgress()) {
					setPressed(true); 
					performLongClick();