Retreive imageview resource in other class
<p>I currently have 2 classes named ProjectPreview and ImageAdapter.</p>

<p>Projectpreview has the view along with the actionbar.</p>

<p>I can't figure out a way to get the ID of the current image within the imageview to the delete on the action bar.</p>

<p>oncreate in projectpreview:</p>

<pre><code>    Gallery gallery = (Gallery) findViewById(R.id.gallery);
    gallery.setAdapter(new ImageAdapter(this));

    gallery.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView parent, View v, int position, long id) {
            ImageAdapter ia1 = new ImageAdapter();
            ia1.showLarger(position); }
</code></pre>

<p>Delete code in projectpreview:</p>

<pre><code>public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.menu_delete:
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
</code></pre>

<p>ImageAdapter class:</p>

<pre><code>     public Integer[] mImageIds = {
            R.drawable.sample_1,
            R.drawable.sample_2,
            R.drawable.sample_3,
            R.drawable.sample_4,
            R.drawable.sample_5,
            R.drawable.sample_6,
            R.drawable.sample_7
    };

    public void showLarger(int position){
        ImageView image = (ImageView) findViewById(R.id.iv1);
        image.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
        image.setImageResource(mImageIds[position]);
    }
</code></pre>

<p>I need to figure out a way to get the image.setImageResource(mImageIds[position]); to the other class so that I could remove the mImageIds[position] aka the picture.</p>

<p>Any advice?</p>
