My Android
app needs to populate the ListView
using the data from an ArrayList
.
I have trouble doing this. Can someone please help me with the code?
My Android
app needs to populate the ListView
using the data from an ArrayList
.
I have trouble doing this. Can someone please help me with the code?
Try the below answer to populate listview using ArrayList
You need to do it through an
ArrayAdapter
which will adapt your ArrayList (or any other collection) to your items in your layout (ListView, Spinner etc.).This is what the Android developer guide says:
So your code should look like:
tutorial
Also look up ArrayAdapter interface: