how to show multiple marker on google map android

馋奶兔 提交于 2019-12-01 11:10:51

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.....

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!