draw polyline on roads in android

Home / Uncategorized / draw polyline on roads in android

I currently have a google map in my android app with user location marker on open map and when user click to a position in map a blue marker will shows(destination marker) with a polyline between user location marker and destination marker like this image:

How can i draw this lines in roads ???
I have following code :@Override
public void onMapReady(final GoogleMap googleMap) {
this.googleMap = googleMap;
googleMap.setOnMapLongClickListener(new GoogleMap.OnMapLongClickListener() {
public void onMapLongClick(LatLng latLng) {
destinationLocation = new Location(LocationManager.GPS_PROVIDER);
destinationMarker = googleMap.addMarker(new MarkerOptions().position(latLng).title("your destination").icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_destination_marker)));
Polyline line = googleMap.addPolyline(new PolylineOptions()
.add(new LatLng(userLocation.getLatitude(),
userLocation.getLongitude()), new LatLng(destinationLocation.getLatitude(),


Read more

Leave a Reply

Your email address will not be published. Required fields are marked *