smooth images whlie translation in android
<p>I am trying to translate an image from one position to another while user drags that image, the image is moving but it's not moving accurate and it's just jumping, please help me because I am new to android. Below is my XML File and followed by java code. Thank you.. </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="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" &gt;       

 &lt;ImageView
    android:id="@+id/imageView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"        
    android:layout_marginLeft="230dp"
    android:layout_marginTop="100dp"
    android:layout_marginRight="400dp"
    android:layout_marginBottom="100dp"
    android:background="#000000"        
    android:src="@drawable/desert" /&gt;

 &lt;ImageView
    android:id="@+id/imageView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/imageView1"
    android:layout_alignTop="@+id/imageView1"
    android:layout_alignRight="@+id/imageView1"
    android:layout_alignBottom="@+id/imageView1"            
    android:layout_margin="10dp"
    android:layout_toRightOf="@+id/imageView1"
    android:src="@drawable/logo" /&gt;

&lt;ListView
    android:id="@android:id/list"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="800dp" &gt;
&lt;/ListView&gt;   

&lt;/RelativeLayout&gt;
</code></pre>

<p>Java File</p>

<pre><code>public class Display extends ListActivity implements OnTouchListener
{
ArrayList&lt;String&gt; listimages;
ListView images;    
ImageView imgback,imgfront; 

@Override
protected void onCreate(Bundle savedInstanceState)
{       
    super.onCreate(savedInstanceState);
    setContentView(R.layout.display);
    images=(ListView) findViewById(android.R.id.list);
    listimages=new ArrayList&lt;String&gt;();
    listimages.add("/Pictures/Chrysanthemum.jpg");
    listimages.add("/Pictures/Koala.jpg");
    setListAdapter(new listAdapter(getApplicationContext(), listimages));

    imgback=(ImageView) findViewById(R.id.imageView1);
    imgfront=(ImageView) findViewById(R.id.imageView2);
    //imgback.setImageBitmap("From Camera");    

    //Matrix mat=new Matrix();

}

@Override
protected void onListItemClick(ListView l, View v, int position, long id) 
{       
    super.onListItemClick(l, v, position, id);      
Toast.makeText(getApplicationContext(), "Image:    "+String.valueOf(position)+" 

    Clicked", Toast.LENGTH_LONG).show();
    if(position==0)
    {           
    imgfront.setImageBitmap(getbitmap("/sdcard/Pictures    

             /Koala.jpg"));         
        imgfront.setOnTouchListener(this);
    }
    else if(position==1)
    {
        imgfront.setImageBitmap(getbitmap("/sdcard/Pictures

             /Chrysanthemum.jpg"));
    }
}

public Bitmap getbitmap(String path)
{
    Bitmap bitmap=BitmapFactory.decodeFile(path);       
    return bitmap;
}

@Override
public boolean onTouch(View arg0, MotionEvent arg1) 
{
    Toast.makeText(getApplicationContext(), "Touch Event Occured",   

     Toast.LENGTH_LONG).show();
    Toast.makeText(getApplicationContext(), "x value: 

    "+String.valueOf(arg1.getX())+" Y value: "+String.valueOf(arg1.getY()),  

      Toast.LENGTH_LONG).show();        


    imgfront.setTranslationX(arg1.getX());
    imgfront.setTranslationY(arg1.getY());  

    return true;
}   

 }
</code></pre>
