How do I get the Uri of an image from its returned position of a gridview
<p>I currently have a gridview that returns an images position/id to a parent activity. I would also like to return or extract the images Uri to the parent activity and set it to a variable that can be parsed somewhere else in the parent activity. I've been looking for a bit but cant quite find a solution that fits what I'm attempting.</p>

<p>My gridview child activity that returns the position</p>

<pre><code>@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.grid_layout);

    GridView gridView = (GridView) findViewById(R.id.grid_view);

    // Instance of ImageAdapter Class
    gridView.setAdapter(new ImageAdapter(this));

    /**
     * On Click event for Single Gridview Item
     * */
    gridView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView&lt;?&gt; parent, View v,
                int position, long id) {


            Intent data = new Intent(PicPicker2.this, PictureActivity.class);
            // passing array index
            data.putExtra("id", position);
            setResult(Activity.RESULT_OK, data);
            finish();
        }
    });
}
</code></pre>

<p>}</p>

<p>Where I currently catch the result in the parent activity</p>

<pre><code>            else if (reqCode == 2) {


                // Selected image id
                int position = data.getExtras().getInt("id");
                ImageAdapter imageAdapter = new ImageAdapter(this);
                ChosenImageView.setImageResource(imageAdapter.mThumbIds[position]);
              }
            }
        }     
</code></pre>

<p>Where I want to parse the variable</p>

<pre><code>        Uri attached_Uri = Uri.parse("SOME VARIABLE OF THE RETURNED URI");
</code></pre>

<p>I want to set Uri attached_Uri = Uri.parse() to the item that was clicked in the gridview. I'm just a weekend Android tinkerer trying to learn the concepts of the platform so explanations and examples go a long way for me and are greatly appreciated. </p>

<p>Added my imageadapter</p>

<p>public class ImageAdapter extends BaseAdapter {</p>

<pre><code>private Context mContext;


// Keep all Images in array
public Integer[] mThumbIds = {
        R.drawable.pic_1, R.drawable.pic_2,
        R.drawable.pic_3, R.drawable.pic_4,
        R.drawable.pic_5, R.drawable.pic_6,
        R.drawable.pic_7, R.drawable.pic_8,
        R.drawable.pic_9, R.drawable.pic_10,
        R.drawable.pic_11, R.drawable.pic_12,
        R.drawable.pic_13, R.drawable.pic_14,
        R.drawable.pic_15
};

// Constructor
public ImageAdapter(Context c){
    mContext = c;
}

@Override
public int getCount() {
    return mThumbIds.length;
}

@Override
public Object getItem(int position) {
    return mThumbIds[position];
}

@Override
public long getItemId(int position) {
    return 0;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ImageView imageView = new ImageView(mContext);
    imageView.setImageResource(mThumbIds[position]);
    imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
    imageView.setLayoutParams(new GridView.LayoutParams(70, 70));
    return imageView;
}
</code></pre>

<p>}</p>
