Code example for ClipData

Methods: addItem

0
			public boolean onLongClick(View v) {
				ViewHolder holder = (ViewHolder) v.getTag();
				String text = (String) holder.text.getText();
				ClipData.Item item = new ClipData.Item(text);
 
				ClipData dragData = new ClipData(text, new String[] { ClipDescription.MIMETYPE_TEXT_PLAIN, ClipDescription.MIMETYPE_TEXT_PLAIN }, item);
				dragData.addItem(new ClipData.Item(String.valueOf(holder.position)));
 
				// Instantiates the drag shadow builder. 
				DragShadowBuilder myShadow = new MyDragShadowBuilder(v);
 
				// Starts the drag 
				v.startDrag(dragData, // the data to be dragged
						myShadow, // the drag shadow builder
						null, // no need to use local data 
						0 // flags (not currently used, set to 0) 
				); 
				return true; 
			} 
		});