Code example for MotionEvent

Methods: getActiongetYsetAction

0
			} 
		} 
	} 
 
	public void onTouchEvent(MotionEvent event) {
		switch (event.getAction()) {
			case MotionEvent.ACTION_UP:
				if (currentState == State.PULLING) {
					resetHeaderViewHeight(0); 
				} 
				if (currentState == State.PULLING_DOWN) {
					updateState(State.UPDATING);
				} 
				break; 
			case MotionEvent.ACTION_DOWN:
				actionDownY = event.getY();
				break; 
			case MotionEvent.ACTION_MOVE:
				if (currentState == State.NORMAL) {
					if (headerViewIsFirstItem && event.getY() - actionDownY > 10) {
						updateState(State.PULLING);
					} 
				} 
				if (currentState == State.PULLING) {
					setHeaderViewHeight((int)(event.getY() - actionDownY));
					if (firstItemToTopHeight <= 0) {
						updateState(State.NORMAL);
					} else if (firstItemToTopHeight > refreshHeaderhViewOriginHeight) {
						updateState(State.PULLING_DOWN);
					} 
					event.setAction(MotionEvent.ACTION_CANCEL);
				} 
				if (currentState == State.PULLING_DOWN) {
					setHeaderViewHeight((int)(event.getY() - actionDownY));
					if (firstItemToTopHeight < refreshHeaderhViewOriginHeight) {
						updateState(State.PULLING);
					} 
					event.setAction(MotionEvent.ACTION_CANCEL);
				} 
		} 
	} 
 
	public void setAdapter() {