java - Drawing Polylines with an incomplete list of LatLng's in Android (Google Maps) -


i have requirement draw out route on android app using google maps. have list of latlngs must use customer unfortunately not complete list of lats , longs partial webservice trying iterate through list of waypoints webservice , draw correct route uses these points. unfortunately draw straight line between waypoints or latlng's. suggestions on how iterate through , draw route?

my code:

private void showevacuationroute(list<latlng> latlnglist){     latlng currentloc = null;     polylineoptions rectline = new polylineoptions().width(5).color(color.red);     (latlng latlng : latlnglist){            (int = 0; < latlnglist.size() - 1; i++) {             if (i % 2 == 0){                 currentloc = new latlng(latlng.latitude, latlng.longitude);               } else {                 latlng topostion = new latlng(latlng.latitude, latlng.longitude);                 gmapv2direction md = new gmapv2direction();                 document doc = md.getdocument(currentloc, topostion, gmapv2direction.mode_driving);                 arraylist<latlng> directionpoint = md.getdirection(doc);                    for(int j = 0 ; j < directionpoint.size() ; j++) {                               rectline.add(directionpoint.get(j));                 }                }         }      }     if (!(rectline == null)){         map.addpolyline(rectline);     }  } 


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -