views:

189

answers:

1

I've got a class called PhoneContact with 3 properties: Title, Description and PhoneNumber

If I have a collection of these, how would I go about binding these to a ListView containing a TextView for each property?

+4  A: 

Extend ArrayAdapter, overriding the getView(int, View, ViewGroup) method. To hook up your custom adapter, I'll assume your Activity extends ListActivity. In one of the lifecycle methods (such as onCreate, onResume, or onStart), call setListAdapter(myCustomAdapter).

This article shows how to do it: Android Series: Custom ListView items and adapters.

Eric Burke
I'd just been going through that page when you answered, exactly what I was after. Thanks!
TreeUK