Hi
I found a solution

In the GridView I pass the images with ImageView Class:

gridview.setAdapter(imageview);

The images are in res/drawable path an we set them by:

imageview.setImageResource(mThumbIds[position]); // mThumbIds is an
array with images id's

Then we know that ImageView is an extend class from View Class.
View Class define a method setId(int), so:

imageView.setId(mThumbIds[position]);

Here we considere mThumbIds as public array.

To get the reference of image id we can set next:


public AdapterView.OnItemClickListener pulsarImagen = new
AdapterView.OnItemClickListener()
    {
                public void onItemClick(AdapterView<?> arg0, View arg1, int
arg2,long arg3)
                {
                Intent intent = new Intent(this , new.class);

                intent.putExtra("id", arg1.getId());
                startActivity(intent);
                //finish();
                }
    };

arg1 is a View and we can get the id

That's all

Thanks to all

ENM

On 20 nov, 09:56, Abderrahim Baallal <baallal.abderra...@gmail.com>
wrote:
> hi, i did this trick but in other way ,in the same activity and in the same
> layout, i define an imageView witch hidden , and when when i click in the
> gridView i set the image in this imageView and i set it also visible .

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to