title: Dragging a TextView into an EditText
body: <p>I am new to android programming and I am trying to drag a textview into an edittext.</p>
  
  <p>I have created an OnTouchListener which selects the text in the textview and stores it as ClipData.</p>
  
  <p><strong>OnTouchListener:</strong></p>
  
  <pre><code>item.setOnTouchListener(new OnTouchListener(){
  
  @Override
  public boolean onTouch(View view, MotionEvent motionEvent) {
      if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
          ClipData data = ClipData.newPlainText("text", str);
          DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view);
          view.startDrag(data, shadowBuilder, view, 0);
  
      }
          return true;    
    }
  
  });
  </code></pre>
  
  <p>I want to then append this data onto an EditText view. For this I implemented an OnDragListener for the EditText</p>
  
  <p><strong>OnDragListener:</strong></p>
  
  <pre><code>    TextStage.setOnDragListener(new OnDragListener(){
  
          @Override
          public boolean onDrag(View v, DragEvent event) {
              switch(event.getAction())
              {
                  case DragEvent.ACTION_DRAG_STARTED: break;
                  case DragEvent.ACTION_DROP: ClipData.Item item = event.getClipData().getItemAt(0);
                                              CharSequence paste = item.getText();
                                              v.append(paste.toString());                                         
                                              break;
                  case DragEvent.ACTION_DRAG_ENDED: break;
                  case DragEvent.ACTION_DRAG_EXITED: break;
                  default: break;
              }
  
              return false;
          }
  
      });
  </code></pre>
  
  <p><strong>The problem:</strong></p>
  
  <p>When I complete the drag, two instances of the textview are appended to the edittext.</p>
  
  <p>Example:</p>
  
  <p><strong>String in TextView:</strong> "I want to drag this"</p>
  
  <p><strong>After drop in EditText:</strong> "I want to drag this I want to drag this"</p>
  
  <p>I don't see why there should be two drops, as I have overrided onDrag for edittext.
  I have also taken care of all the DragEvent actions.</p>
  
  <p><strong>EDIT:</strong>  After seeing the log, I see this message even after I remove the DragListener</p>
  
  <pre><code>11-20 07:30:04.885: I/ViewRootImpl(3518): Reporting drop result: true
  </code></pre>
  
  <p>Any insight into what ViewRootImpl might be?</p>