> 1. I looked at the getView funtcion:          View    getView(int position,
> View convertView, ViewGroup parent).
>
>   I can understand that position refers to the particular element on
> the list and ViewGroup parent to the custom view I am using for the
> list items. But what does View convertView stand for?

If convertView is null, ignore it.

If convertView is not null, it is a View you previously created in
getView() being returned to you for potential recycling. If you only are
using one type of row View, then you can cast convertView to whatever your
rows are (e.g., LinearLayout) and repopulate the existing widgets, rather
than using ViewInflate or manual construction to create new widgets again.
Creating widgets and inflating layout XML is a relatively time-consuming
process, so convertView gives you a means of optimizing performance a bit.

For the short term, I would ignore convertView, get the rest of getView()
working the way you want, then consider making use of convertView.

> 3. 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.
>
> Please elaborate about how this should be done.

Here are a couple of threads on this topic I've contributed to over the
past few months:

http://groups.google.com/group/android-developers/browse_thread/thread/925bd3f4c1c3aefb

http://groups.google.com/group/android-developers/browse_frm/thread/355d3cdfa1c787b8/2009b42cad4537ce?lnk=gst&q=commonsware#2009b42cad4537ce

List6.java in the ApiDemos in the SDK is one of the closer examples to
this, and I'm sure there are any number of tutorials over on anddev.org
that cover it as well.

And I'll have a series of blog posts out on AndroidGuys about this,
starting Monday. And I'll have a new section on this in version 1.1 of
_The Busy Coder's Guide to Android Development_, which should be available
to subscribers by August 1st.

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