views:

59

answers:

3

What I want to do in one of my tabs in my application is have a ListView of contacts. Though, in that example, the ListView is made from an array of Strings. Is there a way that I can create one of those using the values from an ArrayList?

Thanks!

A: 

Yes. Create an ArrayAdapter and pass in the ArrayList in the [constructor][2].

[2]: http://developer.android.com/reference/android/widget/ArrayAdapter.html#ArrayAdapter(android.content.Context, int, T[])

BrennaSoft
What should I put for the `int textViewResourceId` ?
Chiggins
I think that would be the resource of the text view that represents one of the items in the list. R.id.list_item
MatrixFrog
+1  A: 

Yes you can.

This tutorial explains everything, including how to do the xml files and java files.

http://www.softwarepassion.com/android-series-custom-listview-items-and-adapters/

Rafael Carvalho
A: 

I actually did some more Google'ing of this, and I found this:

String str [] = (String []) neoFriends.toArray (new String [neoFriends.size ()]);

Where neoFriends is the ArrayList<String>.

Chiggins