how to show a image in a image view, choosen from an gridview.GridView is within in alert box
<p>i am havin an activity which consist of a clickable imageview(with title "choose your image").Some thing like this:  </p>

<pre><code>setContentView(R.layout.main);
        ImageView button = (ImageView)findViewById(R.id.categories);
        button.setClickable(true);
</code></pre>

<p>now by clicking the image view a popup/alert opens consisting of a grid view form by images from my drawable folder.Something like this:</p>

<pre><code>protected Dialog onCreateDialog(int id) {   

        switch(id) {   

        case CATEGORY_ID:   

         AlertDialog.Builder builder;   
            Context mContext = this;   
            LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER_SERVICE);   
            View layout = inflater.inflate(R.layout.categorydialog,(ViewGroup) findViewById(R.id.layout_root));   
            GridView gridview = (GridView)layout.findViewById(R.id.gridview);   
            gridview.setAdapter(new ImageAdapter(this));   

            gridview.setOnItemClickListener(new OnItemClickListener()   
            {
                public void onItemClick(AdapterView&lt;?&gt; parent, View v,int position, long id) {   
                 Toast.makeText(v.getContext(), "Position is "+position, 3000).show();
                 }   
            });

            ImageView close = (ImageView) layout.findViewById(R.id.close);
            close.setOnClickListener(new View.OnClickListener() {
    public void onClick(View v){
              dialog.dismiss();
            }
            });

            builder = new AlertDialog.Builder(mContext);   
            builder.setView(layout);   
            dialog = builder.create();   
            break;   
        default:   
            dialog = null;   
        }   
        return dialog;   
    }
</code></pre>

<p>i am able to click these image.  </p>

<p>Problem:<br>
i want to choose one from these images and set it in the image view which user had clicked.
any suggestios!
Thanks!!</p>
