Hi
I find 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

ENM

On 19 nov, 19:02, erick nicolas <[email protected]> wrote:
> Hi
> I've got a problem
> My app show a first layout like:
>
> Gridview1 (3 images in 1 row)
> ImageView1 (1 image)
> Gridview2 (3 images in 1 row)
> ImgaeView2 (1 image)
> Gridview3  (3 images in 1 row)
> ImgaeView3 (1 image)
>
> When you clik over an image it will be open full screen in a second
> layout
>
> The problem was that I don't know how to pass the image to the new
> intent
>
> Now I've the next code:
>
> public AdapterView.OnItemClickListener pulsarImagen = new
> AdapterView.OnItemClickListener()
>     {
>                 public void onItemClick(AdapterView<?> arg0, View arg1, int
> arg2,long arg3)
>                 {
>                         Intent intent = new Intent(GridViewer.this , 
> GalleryViewer.class);
>                         intent.putExtra("id", arg0.getItemIdAtPosition
> (arg2));
>                         startActivity(intent);
>                         //finish();
>                 }
>     };
>
> But the ItemID is always 0...
>
> Before I've only one gridview and then I passed the item's position.
> But now I've 3 different gridviews and I don't know if the position of
> item selecte it's from gridview 1,2 or 3.
>
> I supose that the great solutin it will be to pass the id resource
> (image) but I don't know how to pass it.
>
> Can you help me?
>
> ENM

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to