Sylvester Steele wrote:
> arrayAdapter1= new ArrayAdapter <String>(this, R.layout.component,
> R.id.name);
> 
> is how I initialize my adapter. I do not override any methods.
> 
> "component" is my custom component and "name" is a textView that takes
> the value.

That may make things more complicated for getting at your buttons.

You have two choices that I can think of:

1. Make a subclass of ArrayAdapter, override getView(), and use that to 
create your row Views, and take that opportunity to set your listener on 
your buttons.

2. Sometime, walk the rows (child views) of the ListView. I don't know 
when that would be safe. getChildCount() and getChildAt() will probably 
work to give you your row Views, though I haven't tried this. And if 
Android for some reason does not recycle your row Views when the list 
scrolls, you would somehow need to trap the scroll event and check all 
the rows to make sure your buttons have their listeners.

I'm a fan of option #1, but that's just me.

Your current implementation (supplying an alternate layout resource ID 
in the adapter constructor) probably works just fine for rows that you 
do not need to modify, where Android can handle everything for you.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
Warescription: All titles, revisions, & ebook formats, just $35/year

--~--~---------~--~----~------------~-------~--~----~
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
[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