> It is unclear who "this" is in "this.findViewById(R.id.dButton)".
> referred to the activity in the above post.
>
> But changed it now to:
>
>  deleteButton1=
> (Button)customComponent.findViewById(R.id.deleteButton);
>
>
> customComponent is initialized as:
>
> customComponent= new ConversationListView(this);
>                               --OR--
> customComponent=
> (ConversationListView)this.findViewById(R.layout.component);
>
>
> both don't work.

If I understand your situation correctly, the Button(s) in question are in
the rows of the ListView, one button per row.

If so, you need to call findViewById() on the *row*, not the ListView, and
not the activity. After all, the row is where the Button is.

I don't know how you have created your Adapter for supplying to your
ListView subclass. I am assuming that you implemented an Adapter subclass
that overrode getView() and is returning your row objects on demand,
perhaps instantiated via ViewInflate.

It is at that point, when you are creating your row, that you have the row
object (e.g., a LinearLayout containing your Button and other stuff) and
can call findViewById() on the row to get the row's button.

If you're not in a hurry, I'll be covering this stuff as part of a series
of Building 'Droids blog posts over on AndroidGuys, hopefully starting
Monday. I'm only posting 1-2 times a week, though, so it'll take 2-3 weeks
to get through all of this...

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
_The Busy Coder's Guide to Android Development_ -- Available Now!



--~--~---------~--~----~------------~-------~--~----~
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]
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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to