I have displayed multiple pins in map in same color but i need to display different color pins for each location, Here is the code,
Drawable drawable;
AddItemizesOverlay itemizedOvrealy;
drawable = this.getResources().getDrawable(R.drawable.color1);
itemizedOverlay = new AddItemizedOverlay(drawable, mapView);
for(int i=0;i<paramLat.size();i++)
{
lat = Double.parseDouble(paramLat.get(i));
lon = Double.parseDouble(paramLong.get(i));
geoPoint = new GeoPoint((int)(lat * 1E6), (int)(lon *1E6));
geopoints.add(geoPoint);
List<Overlay> mapOverlays = mapView.getOverlays();
name = calloutName.get(i);
overlayitem[i] = new Overlay
Item(geoPoint, calloutName.get(i), "Time: " + calloutTime.get(i));
itemizedOverlay.addOverlay(overlayitem[i]);
mc.animateTo(geoPoint);
}
mapView.getOverlays().add(itemizedOverlay);
AddItemizedOverlay.java
public AddItemizedOverlay(Drawable drawable, MapView mapView) {
super(boundCenter(drawable), mapView);
c = mapView.getContext();
}
Here passed the pin image as drawable name as ‘color1’, but i need to send different colors pin as drawable. and in result each location marked by different pins.
According to your code,
itemizedOverlay = new AddItemizedOverlay(drawable, mapView);here you make any condition and change the drawable for eachparamLat. So replace youritemizedOverlayinside for loop and set different drawable with if condition.