How can I draw the line between one Geo point to another in Google maps version 2?
I know some accepted answers are available here. According to those answers I have to override draw() function. But I Used fragments for displaying Google maps. so I can not override that function from my activity.
Can any one help me out?
How can I draw the line between one Geo point to another in Google maps version 2?
GeoPoint
is only for Maps V1. To draw lines in Maps V2, you would add a Polyline to your GoogleMap
:
PolylineOptions line=
new PolylineOptions().add(new LatLng(40.70686417491799,
-74.01572942733765),
new LatLng(40.76866299974387,
-73.98268461227417),
new LatLng(40.765136435316755,
-73.97989511489868),
new LatLng(40.748963847316034,
-73.96807193756104))
.width(5).color(Color.RED);
map.addPolyline(line);
(from this sample app, described in detail in this book)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With