> how would you implement a list containing multiple columns like in the
> contacts demo application which contains the names and a star with
> "mobile" at the right.
> I want to display my contacts by adding icons behind the names in an
> additional column.

Generally speaking, you need to provide a more complicated View for each
row than the traditional TextView.

For simple cases, you may be able to get away with just creating a layout
XML file for the row (e.g., LinearLayout with an ImageView for your icon
and a TextView for your name) and supply that resource ID instead of the
ever-popular android.R.layout.simple_list_item_1 in your Adapter
constructor.

For more power, subclass your desired Adapter and implement getView(),
where you can return (or re-populate) Views you create either by manual
construction or by using ViewInflate on a layout XML file.

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, like I just told Mr. Steele, I'll be writing up all of this over on
the AndroidGuys blog over the next few weeks.

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