Creating a ListView layout from an ArrayList

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!

Answers


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/


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


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[])


Need Your Help

Reorder an NSMutableArray according to another array

ios objective-c arrays cocoa-touch nsmutablearray

Say I have two arrays, one representing a desired order for the other. I'd like to be able to apply the order to the array.

How to display multiple result from MySql query using PHP

php html mysql

I have my current code working perfectly but I needed help on when I want the code to display as many queries exist in the table called wine... for example if there are more than wine type in categ...