Highlight a specified route on Google Maps v2 Android

后端 未结 3 2016
离开以前
离开以前 2020-12-24 03:48

Right, so I\'m currently using the Google Directions API in my app to retrieve the route between two locations.

When I send a request for a route directions, I retri

3条回答
  •  自闭症患者
    2020-12-24 04:28

    There is a simple solution

    Add a library

    compile 'com.google.maps.android:android-maps-utils:0.4+'

    reference from https://developers.google.com/maps/documentation/android-api/utility/setup

    //Getting the points String from response of NavigationAPI call
    String polyz=routeSteps.get(0).getOverview_polyline().getPoints();
    //Decoding the LatLng Points using PolyUtil Class used from above Library
    List points=PolyUtil.decode(polyz);
    polyline.addAll(points);
    googleMap.addPolyline(polyline);
    

提交回复
热议问题