title: How to move ImageView along with finger using onTouchListener() in android?
body: <p>I want to move an imageview along with finger using onTouchListener() in android......</p>
  
  <p>I have created an xml --></p>
  
  <pre><code>        &lt;?xml version="1.0" encoding="utf-8"?&gt;
      &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:orientation="vertical" &gt;
      &lt;RelativeLayout
          android:id="@+id/rel_slide"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:background="@android:color/background_dark" &gt;
  
          &lt;ImageView
              android:id="@+id/img_arrow"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:src="@drawable/ic_launcher"/&gt;"
      &lt;/RelativeLayout&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Now in Activity file I implemented onTouchListener to this imageView: <strong>img_arrow</strong></p>
  
  <p>here is the code:</p>
  
  <pre><code>((ImageView) findViewById(R.id.img_arrow)).setOnTouchListener(new OnTouchListener() {
  
                  @Override
                  public boolean onTouch(View arg0, MotionEvent arg1) {
              switch (arg1.getAction()) {
                case MotionEvent.ACTION_MOVE:
                       LayoutParams layoutParams = (LayoutParams)v.getLayoutParams();
                   layoutParams.leftMargin=(int)arg1.getX();
               layoutParams.topMargin=(int)arg1.getY();
               v.setLayoutParams(layoutParams);
                    break;
              }
          return true;
          }
              });
  </code></pre>
  
  <p><strong>But this results in flikering of imageView</strong> showing 2 at a time may be because of very fast setting of layoutParams when <strong>ACTION_MOVE</strong> called.....plz help</p>