Xamarin – Binding data to ListView in Android

In the previous post, we used a ListActivity for displaying data or collection. In this post we would use the ListView control and bind data or collection to it.

We would need a template for the ListView, so let’s add one.


Add an XML file to the Layout folder.



Add a TextView in the XML file. This is for ListView template.


And as you see in the below image, the Activity1 is inherited from Activity class unlike our last post where we inherited from ListActivity. Rest of the code is self-explanatory. We are setting the Adapter property of the ListView with ArrayAdapter.


Now, let’s run the application and see the ListActivity in action


As you see, unlike ListActivity, we have other controls in the Activity.

Hope this post helps, thanks for reading.


Full Source Code: Click Here.