Hi Erick,
I didn't find a way to get the resource id of an ImageView after
setting it (which seems odd, someone may know more about this than I),
but if you are setting up your images by using setImageResource(int
resId), for example, you could extend the ImageView class to one that
overrides setImageResource(), and add a getId() method:
...
int mId;
@Override
setImageResource(int resId) {
mId = resId;
super.setImageResource(resId)
}
getId() {
return mId;
}
....
then in your listener use:
intent.putExtra("id", arg0.getItemAtPosition (arg2).getId());
Havn't tried it personally, but might help :)
Steve
On Thu, Nov 19, 2009 at 1:02 PM, 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 Developers" 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-developers?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en