Thanks for ur interest kartheek. I solved it. I was doing a mistake, I
sould've call gridview.setItemOnClick() instead!

happy coding

On Jul 20, 1:22 pm, kartheek karthikeya <[email protected]>
wrote:
> may be you forgot to setclickble(true)  to that image view
>
> On Sun, Jul 19, 2009 at 5:49 PM, Mark Murphy <[email protected]>wrote:
>
>
>
> > arin wrote:
> > > Hi Everyone,
>
> > > I have the following code
>
> > > Java:
>
> > >                     imageView.setImageResource(mThumbIds[position]);
> > >                  imageView.setOnClickListener(new OnClickListener(){
>
> > >                         �...@override
> > >                          public void onClick(View arg0) {
> > >                               // TODO Auto-generated method stub
>
> > >                               try{
>
> > >                                  Intent myIntent = new Intent();
> > >                                  Log.i("id clicked value",
> > > imageView.getId()+"");
> > >                                  myIntent.putExtra("picID",
> > > imageView.getId());
>
> > >                                  }catch(Exception e){
> > >                                    e.printStackTrace();
> > >                                  }
> > >                          }
>
> > >                  });
>
> > >                  return imageView;
>
> > > Basically I am initializing a new Image view based on a condition and
> > > then attaching an onClickListener for each view. But the getId()
> > > returning a -1 everytime. Why so?
>
> > Perhaps you are using an ArrayAdapter, which does not have IDs.
>
> > --
> > Mark Murphy (a Commons Guy)
> >http://commonsware.com|http://twitter.com/commonsguy
>
> > Android Development Wiki:http://wiki.andmob.org
>
>
--~--~---------~--~----~------------~-------~--~----~
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