Code example for DragEvent

Methods: getAction, getX, getY

0
				attachDragCanvas(); 
				mDragCanvas.setOnDragListener(new OnDragListener() {
 
					@Override 
					public boolean onDrag(View v, DragEvent event) {
						final int action = event.getAction();
						switch (action) {
						case DragEvent.ACTION_DRAG_STARTED:
							obtainTargetArea(mTargetView, mTargetArea);
							break; 
						case DragEvent.ACTION_DRAG_LOCATION:
							break; 
						case DragEvent.ACTION_DRAG_ENDED:
							detachDragCanvas(); 
							break; 
						case DragEvent.ACTION_DROP:
							Point p = translateDragPoint(event.getX(),
									event.getY());
							if (mTargetArea.contains(p.x, p.y)) {
								Toast.makeText(
										DragEnhancement.this,
										"The dropped was on the target view!!!", 
										Toast.LENGTH_SHORT).show();