On image click, link to another activity, displaying that image in full size
<p>I have created a <code>ListView</code> and on click on my first view I'm displaying a <code>GridView</code> of images. Now i want that when i click on any of that image it gets displayed on another page. </p>

<p>Can you nudge me towards the right direction? </p>

<p>This my code:</p>

<p>1:> Invoking Activity</p>

<pre><code>public class ImageExercise extends Activity{
     /** Called when the activity is first created. */
    public static int pos;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.image);
        GridView gridview = (GridView) 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)
                                     {
                                     Intent intent = new Intent(ImageExercise.this,FullImage.class);
                                     pos=position;



                                     startActivity(intent);
                                   // finish();
                                     }

        });

    }
private void showImage(View view, int position) {
    ImageView imgView = (ImageView) view; 
    imgView.setImageResource(position); 
    imgView.setId(position);
}


}
class ImageAdapter extends BaseAdapter {
public static Integer[] mThumbIds = {

  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, R.drawable.sample_8,
    R.drawable.sample_9,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, R.drawable.sample_8,
    R.drawable.sample_9


};
    private Context mContext;

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

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

public Object getItem(int position) {
    return null;
}

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

// create a new ImageView for each item referenced by the Adapter
public View getView(int position, View convertView, ViewGroup parent) {
    ImageView imageView;
    if (convertView == null) {  // if it's not recycled, initialize some attributes
        imageView = new ImageView(mContext);
        imageView.setLayoutParams(new GridView.LayoutParams(85, 85));
        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        imageView.setPadding(8, 8, 8, 8);
    } else {
        imageView = (ImageView) convertView;
    }

    imageView.setImageResource(mThumbIds[position]);
    return imageView;
}
</code></pre>

<p>2:-> Invoked Activity to which link is to be made:</p>

<pre><code>public class FullImage extends Activity{
     @Override


 public void onCreate(Bundle savedInstanceState) {
       // super.onCreate(savedInstanceState);




        setContentView(R.layout.fullimage);

 }
</code></pre>

<p>}</p>
