Friday, January 11, 2013

[android-developers] trying to get polylines to work in google maps api v2

Using google maps api v2, I had multiple markers displaying correctly
but I wanted to add a line joining them, so I added the polyline
functionality below. However, when I rendered map again, now it just
shows map without markers or line:

Iterator<Map<String, String>> iterator2 = historyData.iterator();
while(iterator2.hasNext()){

Map<String, String> item = iterator2.next();

double currentLat = Double.parseDouble(item.get("latitude"));
double currentLong = Double.parseDouble(item.get("latitude"));


Double.parseDouble(item.get("longitude"));


mMap.addMarker(new MarkerOptions()
.position(new LatLng(currentLat, currentLong))
.title(item.get("address")));



Polyline line = mMap.addPolyline(new PolylineOptions()
.add(new LatLng(currentLat, currentLong))
.width(5)
.color(Color.RED));


}

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate