How does one drag an image form one layout to another layout
<p>How does one drag an image from one layout to another layout. I am attaching what i have done so far. I have two layouts in a single view. I can move the image on its initial layout. But the problem is i cant move the image to a different layout. Please help me find the solution to this problem.</p>

<pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
 &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"&gt;   &lt;LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1"&gt;
        &lt;ImageView 
        android:id="@+id/imageView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:src="@drawable/icon"
        android:scaleType="matrix" 
        android:layout_weight="1"&gt;
        &lt;/ImageView&gt;

        &lt;ImageView 
        android:id="@+id/imageView2"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:src="@drawable/icon"
        android:scaleType="matrix" 
        android:layout_weight="1"
        android:background="#00aa00"
        &gt;
        &lt;/ImageView&gt;


           &lt;/LinearLayout&gt;

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

<p>and main file is</p>

<pre><code>package com.example.multitouch;
import android.app.Activity;
import android.graphics.Matrix;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.ImageView;

public class multitouch extends Activity  implements OnTouchListener{

    /** Called when the activity is first created. */
    Matrix matrix = new Matrix() ;
    Matrix eventmatrix = new Matrix();
    static float centerX,centerY;
    final static int NONE = 0;
    final static int DRAG = 1;
    int touchState=NONE;


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        ImageView view = (ImageView) findViewById(R.id.imageView);
        view.setOnTouchListener(this);      
    }

    @Override
    public boolean onTouch(View v, MotionEvent event) {
        // TODO Auto-generated method stub
        ImageView view = (ImageView) v;
        final int action = event.getAction();


        switch(action){
        case MotionEvent.ACTION_DOWN:
            touchState= DRAG;
            centerX= event.getX();
            centerY = event.getY();         
            eventmatrix.set(matrix);                
        break;      
        case MotionEvent.ACTION_MOVE:
            if (touchState == DRAG) {
            matrix.set(eventmatrix);
            matrix.setTranslate(event.getX()-centerX,event.getY()-centerY);
            }           
            view.setImageMatrix(matrix);
            //view.setImageMatrix(eventmatrix);
        break;  
        case MotionEvent.ACTION_UP:
            //touchState=NONE;
            break;

        }       
        return true;
    }
}
</code></pre>

<p>Please give me a reply</p>
