Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Cross App Drag and Drop

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.

Cross App Drag and Drop

Avatar for funnelbit

funnelbit

March 30, 2016

More Decks by funnelbit

Other Decks in Technology

Transcript

  1. ૹΔଆ ClipData.Item item = new ClipData.Item("ςΩετ");
 
 String[] mimeType =

    new String[1];
 mimeType[0] = ClipDescription.MIMETYPE_TEXT_PLANE;
 
 ClipData clipData = new ClipData( new ClipDescription("text", mimeType), item); 
 textView.startDragAndDrop(clipData, new MyDragShadowBuilder(view), null, View.DRAG_FLAG_GLOBAL);
  2. ΋Β͏ଆ root.setOnDragListener(new View.OnDragListener() {
 @Override
 public boolean onDrag(View view, DragEvent

    dragEvent) {
 if (dragEvent.getAction() == DragEvent.ACTION_DROP) {
 String item = dragEvent.getClipData().getItemAt(0).getUri();
 Log.e("text", item.toString());
 }
 return true;
 }
 });