title: Change two childs from Java code
body: <p>I am gonna explain my problem as well as I can.</p>
  
  <p>I have two <strong>linear layout</strong>. Each one has an <strong>imageview</strong>.</p>
  
  <p>I am playing with Drag &amp; Drop propierties. One imageview (A) has an <strong>onTouchListener</strong> and another one (B) has an <strong>onDragListener</strong>.</p>
  
  <p>When I drop the View A into the View B I execute this code:</p>
  
  <pre><code> public boolean onDrag(View imagen_blanca, DragEvent dragEvent) {
      int dragAction = dragEvent.getAction();
  
     if (dragAction == DragEvent.ACTION_DROP) {
       switch (dragEvent.getAction()){
           case DragEvent.ACTION_DRAG_ENTERED:
               break;
           case DragEvent.ACTION_DRAG_EXITED:
               break;
           case DragEvent.ACTION_DROP:
               View imagen_desplazada = (View) dragEvent.getLocalState();
               ViewGroup papa_blanca = (ViewGroup) imagen_blanca.getParent();
               ViewGroup papa_desplazada = (ViewGroup) imagen_desplazada.getParent();
               papa_blanca.removeView(imagen_blanca);
               papa_desplazada.removeView(imagen_desplazada);
               papa_blanca.addView(imagen_desplazada);
               papa_desplazada.addView(imagen_blanca);
               imagen_desplazada.setVisibility(View.VISIBLE);
               break;
      }
  }
      return true;
  }
  </code></pre>
  
  <p><strong>What do I try to do?</strong>
  I get two Linear Layout (papa_blanca and papa_desplazada) who hold an imageview each one.
  I remove his child from each one.
  I add a new child.</p>
  
  <p>It works when I move once. I mean: when I drop A on B they change his father.</p>
  
  <p>My problem comes here. When I try to move again A on B to get the original position that errors come:</p>
  
  <p><img src="https://i.stack.imgur.com/nQad6.png" alt=""></p>