0

Hey Guys I am new to programming apps with the google maps API, and I can create a map showing a single location just fine, but I get confused when trying to implement a way to map multiple locations. (Not hard coded locations.)

In my app I have two Arraylists one containing latitudes and another containing longitudes.

Any suggestions on how I could create geopints from these lists ?

Thanks very much

Grady-lad
  • 105
  • 1
  • 2
  • 9

1 Answers1

0

Assuming you have NumberOfPoints locations stored in latitudes and longitudes. You could do the following:

for(int pointIndex=0; pointIndex<NumberOfPoints; pointIndex++){
   GeoPoint point = new GeoPoint(latitudes[pointIndex],longitudes[pointIndex]);
   OverlayItem overlayitem = new OverlayItem(point, "title", "snipet");
   youOverlayClassHolder.addOverlay(overlayitem);
   mapOverlays.add(itemizedoverlay);
}

Here is a great tutorial going what you are exactly looking for (check Part 2: Adding Overlay Items)

GETah
  • 20,922
  • 7
  • 61
  • 103
  • yea my app was based on that tutorial I have worked out a way to have a list of geopoints but im struggling to add that list of geopoints to a list of overlayitems – Grady-lad Dec 22 '11 at 18:58