Adding multiple markers in Google Maps Api v2

前端 未结 1 984
梦谈多话
梦谈多话 2021-01-03 01:31

I have successfully managed to show the google map api v2. I want to add markers for my positions on it.

As per the documentation, I am only able to add one marker a

1条回答
  •  醉梦人生
    2021-01-03 02:11

    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));
    }
    

    0 讨论(0)
提交回复
热议问题