How To Show Multiple Marker On Google Map Android
i want to show location with multiple markers on google maps android, the problem is when i run my apps, it just show one location/marker, this is my code : public class koordinatT
Solution 1:
Use this:
for (int i = 0; i < yourArrayList.size(); i++) {
double lati=Double.parseDouble(pins.get(i).latitude);
double longLat=Double.parseDouble(pins.get(i).longitude);
MAP.addMarker(new MarkerOptions().position(new LatLng(lati,longLat)).title(pins.get(i).pinname).snippet(pins.get(i).address));
}
Or you can also use this:
for(int pin=0; pin<pins.size(); pin++)
{
LatLng pinLocation = new LatLng(Float.parseFloat(pins.get(pin).latitude), Float.parseFloat(pins.get(pin).longitude));
Marker storeMarker = map.addMarker(new MarkerOptions()
.position(pinLocation)
.title(pins.get(pin).pinname)
.snippet(pins.get(pin).address)
);
}
where latitude and longitude is the String to which you have store in your arraylist with different name.....
Post a Comment for "How To Show Multiple Marker On Google Map Android"