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 android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to