williamj949
williamj949

Reputation: 11316

Multiple marker Not Displaying In Google Maps V2

I am getting the values for latitude,longitude,title and snippet however when i run it the markers are not displaying.Below is my code snippet.

@Override
public void onMapData(boolean isSet)
{

    initializeMap();
    List<LocationBean> locData = pShelf.getLocationData();

    if (!isFromSplash)
        pShelf.setOfferCount(locData.size()); // TODO: Check here if any
                                                // errors for locations list
                                                // in future

    for (int i = 0; i < locData.size(); i++)
    {

        Log.wtf("location Acitvity","Lat"+(int) (locData.get(i).getmLat() * 1e6)+"Long"+(int) (locData.get(i).getmLng() * 1e6));
        Log.wtf("LocationActivity",locData.get(i).getMVendorName());
        Log.wtf("LocationActivity",locData.get(i).getmAddress());
        Log.wtf("LocationActivity","Siiiiize" +locData.size());


         googleMap.addMarker(new MarkerOptions()
                .position(new LatLng((int) (locData.get(i).getmLat() * 1e6),(int) (locData.get(i).getmLng() * 1e6)))
                .title(locData.get(i).getMVendorName())
                .snippet(locData.get(i).getmAddress()));
    }

    listViewBtn.setEnabled(true);
}

Please Help!

Upvotes: 0

Views: 69

Answers (1)

user2808624
user2808624

Reputation: 2530

The coding of latitude and longitude as integers was only used in Google Maps V1. In version 2 LatLng takes doubles as input, and you just have to omit the "* 1e6" part and the cast to int.

Upvotes: 1

Related Questions