Code example for DragEvent

Methods: getAction, getX, getY

0
		super.setAdapter(adapter);
	} 
 
	@Override 
	public boolean onDragEvent(DragEvent event) {
		final int drag_x = (int) event.getX();
		final int drag_y = (int) event.getY();
		int pos = pointToPosition(drag_x, drag_y);
		if (pos == GridView.INVALID_POSITION)
			pos = drag_x < 0 || drag_y < 0
				? 0 
				: adapter.getCount() - 1;
 
		switch(event.getAction()) {
		case DragEvent.ACTION_DRAG_STARTED:
			return true; 
		case DragEvent.ACTION_DRAG_LOCATION:
			adapter.drag_to(pos);
			return true; 
		case DragEvent.ACTION_DROP:
			adapter.drop_at(pos);