akexorcist / GoogleDirectionLibrary

[Android] Library for Google Direction API for Google Maps Android API v2
Apache License 2.0
571 stars 174 forks source link

Not Showing direction #61

Closed shreekant123 closed 4 years ago

shreekant123 commented 5 years ago

Hi...I am using this. it showing the status OK but not showing a path on map

omgitsele commented 5 years ago

When you say OK what do you mean. Also what path did you expect to see?

shreekant123 commented 5 years ago

It returns status OK. and I want to show the path between two LatLong

akexorcist commented 5 years ago

Status OK mean you got the correctly response from the API but you have to check that response have any Latitude/Longitude data to make sure.

maheshj01 commented 5 years ago

@Override public void onDirectionSuccess(Direction direction) { String status = direction.getStatus(); } if the value of status is OK means route can be established within the two locations and you are good to go. use this line of code to get the path

ArrayList<LatLng> directionPositionList = leg.getDirectionPoint(); PolylineOptions polylineOptions = DirectionConverter.createPolyline(this, directionPositionList, 5, Color.RED);

follow this link for more googleMap.addPolyline(polylineOptions);

sabu0balakrishnan commented 5 years ago

ArrayList directionPositionList = leg.getDirectionPoint();

where i can get "leg"

sesesmith30 commented 5 years ago

ArrayList directionPositionList = leg.getDirectionPoint();

where i can get "leg"

Route route = direction.getRouteList().get(0); 
Leg leg = route.getLegList().get(0);

that will give you leg