Creating POIListViewAdapter
In order to create POIListViewAdapter, we will start by creating a custom adapter as follows:
Create a new class named
POIListViewAdapter
.Open the
POIListViewAdapter
class file, make the class a public class, and specify that it inherits fromBaseAdapter<PointOfInterest>
.
Now that the adapter class has been created, we need to provide a constructor and implement four abstract methods.
Implementing a constructor
Let's implement a constructor that accepts all the information we will need to work with to populate the list.
Typically, you need to pass at least two parameters: an instance of an activity because we need the activity context while accessing the standard common resources and an input data list that can be enumerated to populate the ListView
. The following code shows the constructor from the code bundle:
private readonly Activity context; private List<PointOfInterest> poiListData; public POIListViewAdapter (Activity _context, List<PointOfInterest...