In android image replacing issue in gridview
<p>I am providing my code here.i have breaked an image into 9 parts and shown in grid view how to change images by clicking on them  i.e.,(first clicked image should be replaced with second clicked image and vice versa)i have used bitmap array for splitting images and placed them in grid view. so how to change images in grid view by clicking two images the swapping of images should be done how can any one help me.      </p>

<pre><code>public class Imagepieces extends Activity {
                ArrayList&lt;Bitmap&gt; breakedimages,duplicate;
                GridView g;
                int i=0,temp,temp2,rpos;

                @Override

                protected void onCreate(Bundle savedInstanceState) {
                    // TODO Auto-generated method stub
                    super.onCreate(savedInstanceState);
                    setContentView(R.layout.activity_image);
                    breakedimages = getIntent().getParcelableArrayListExtra("breaked image");
                    duplicate = new ArrayList&lt;Bitmap&gt;(breakedimages);
                    Collections.shuffle(duplicate);
                    g = (GridView) findViewById(R.id.gridView1);
                    g.setAdapter(new CutAdapter(this, breakedimages));
                    g.setNumColumns((int) Math.sqrt(breakedimages.size()));
                    g.setOnItemClickListener(new OnItemClickListener() {

                        @Override
                        public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2,
                                long arg3) {                
                            // TODO Auto-generated method stub
                            //=================================================
                            {






                        }
                    });
                }

                class CutAdapter extends BaseAdapter {
                    int iwidth, iheight; 
                    Context context;

                    public CutAdapter(Imagepieces ipieces, ArrayList&lt;Bitmap&gt; breakedimages) {
                        // TODO Auto-generated constructor stub
                        iwidth = breakedimages.get(0).getWidth();
                        iheight = breakedimages.get(0).getHeight();
                        context = ipieces;
                    }

                    @Override
                    public int getCount() {
                        // TODO Auto-generated method stub
                        return duplicate.size();
                    }

                    @Override
                    public Object getItem(int arg0) {
                        // TODO Auto-generated method stub
                        return duplicate.get(arg0);
                    }

                    @Override
                    public long getItemId(int arg0) {
                        // TODO Auto-generated method stub
                        return arg0;
                    }

                    @Override
                    public View getView(int arg0, View arg1, ViewGroup arg2) {
                        // TODO Auto-generated method stub
                        ImageView i=new ImageView(context);

                        i.setLayoutParams(new GridView.LayoutParams(iwidth +5,iheight +5));
                        i.setPadding(0, 0, 0, 0);
                        i.setImageBitmap(duplicate.get(arg0));

                        return i;
                    }

                }
            }



can any one do the need for me as i have stuck here how to move the images among themselves 
</code></pre>
