Code example for Rect

Methods: contains

0
				mRect.set(getLeft(), getTop(), getRight(), getBottom());
				mIsDown = true;
				invalidate();
				break; 
			case MotionEvent.ACTION_MOVE:
				if (mRect.contains(getLeft() + (int) e.getX(), getTop() + (int) e.getY())) {
					break; 
				} 
				if (mIsDown) {
					mIsDown = false;
					invalidate();
				} 
				break; 
			default: 
				mIsDown = false;
				invalidate();
				break; 
		} 
		return super.onTouchEvent(e);
	}