I am trying to add pins on my Xamarin android application. I have already set up the map and I need to create pins from a list array that contains the latitudes and longitudes. I know it's quite simple but I'm stuck here.
Below is my sample code.
public class Farmers
{
public int farmers_id { get; set; }
public string Farmer_name { get; set; }
public double Long { get; set; }
public double Lat { get; set; }
}
private void AddMarker()
{
List<Farmers> farmers =GetFarmers();
foreach (Farmers p in farmers)
{
//HOW TO ADD NEW PINS FOR EACH FARMER ON THE MAP WITH FARMER NAME AS LABEL
}
}
I'm using Xamarin.Forms.Maps
. The issue is more of how to loop.
create a pin and add it to the map