title: onTouchListener: Convert View to ImageView
body: <p>I have a ArrayList of ImageView's in my Activity-Class and all of them should have the same behavior: As soon as you touch them and move your finger to the right or the left, the x-coordinate of this ImageView should also move.</p>
  
  <pre><code>public boolean onTouch(View v, MotionEvent e) {
      float origin_x = 0;
      float origin_x2 = 0;
      RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) v.getLayoutParams();
      switch (e.getActionMasked()) {
          case MotionEvent.ACTION_DOWN: {
              origin_x = e.getX();
              origin_x2 = lp.leftMargin;
              break;
          }
          case MotionEvent.ACTION_MOVE: {
              float diff = e.getX()-origin_x;
              System.out.println(diff);
  
              lp.setMargins((int) (origin_x2+diff), lp.topMargin, 0, 0);
              v.setLayoutParams(lp);
              break;
          }
      }
      return true;
  }
  </code></pre>
  
  <p>But since I can only use the "View"-Object in the ontouch-Method, I have no possibility to find out which ImageView was touched.</p>
  
  <p>Do you know how I should solve this problem?</p>