Hi guys,

I'm trying to create a ListView, with a TextView and two ImageButton
per row. The problem comes when I try to add an OnClickListener to
each button. I did in this way:

-- row.xml --
 <LinearLayout ....... >
   <TextView ...........  />
   <ImageButton
        android:id="@+id/button1"
        android:layout_width="35dip"
        android:layout_height="35dip"
        android:src="@android:drawable/arrow_down_panel_bezel" />
    <ImageButton ...... />
  </LinearLayout>

-- .java --
  .......
  ImageButton ib1 = (ImageButton) this.findViewById(R.id.button1);
  ib1.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View arg0) {
                ........
        }
   });

But I get a NullPointerException.
What's the right way to do that?

Thanks,
Pzikit Bloo
--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to