Note that there are some explanatory texts on larger screens.

plurals
  1. PODisplay Itinerary Only on Google Map (Xml Format ? , 2012)
    text
    copied!<p>So since the 21 July 2012 , as i can hear this is not possible anymore to use KLM to draw a path between 2 GeoPoint , i followed this : </p> <p><a href="https://stackoverflow.com/questions/11745314/why-retrieving-google-directions-for-android-using-kml-data-is-not-working-anymo/11745316#11745316">Why retrieving Google Directions for Android using KML data is not working anymore?</a></p> <p>But i get an Error , Here the onCreate() Method in my Activity : </p> <pre><code> Route route = directions(new GeoPoint((int)(26.2*1E6),(int)(50.6*1E6)), new GeoPoint((int)(26.3*1E6),(int)(50.7*1E6))); RouteOverlay routeOverlay = new RouteOverlay(route, Color.BLUE); mapView.getOverlays().add(routeOverlay); mapView.invalidate(); </code></pre> <p>the Method Called in Activity :</p> <pre><code> private Route directions(final GeoPoint start, final GeoPoint dest) { //Changed from Parser to GoogleParser beacause i had Error GoogleParser parser; //https://developers.google.com/maps/documentation/directions/#JSON &lt;- get api String jsonURL = "http://maps.googleapis.com/maps/api/directions/json?"; final StringBuffer sBuf = new StringBuffer(jsonURL); sBuf.append("origin="); sBuf.append(start.getLatitudeE6()/1E6); sBuf.append(','); sBuf.append(start.getLongitudeE6()/1E6); sBuf.append("&amp;destination="); sBuf.append(dest.getLatitudeE6()/1E6); sBuf.append(','); sBuf.append(dest.getLongitudeE6()/1E6); sBuf.append("&amp;sensor=true&amp;mode=driving"); parser = new GoogleParser(sBuf.toString()); Route r = parser.parse(); return r; } </code></pre> <p>LogCat Output :</p> <pre><code> 11-23 16:07:50.126: E/AndroidRuntime(24124): FATAL EXCEPTION: main 11-23 16:07:50.126: E/AndroidRuntime(24124): java.util.NoSuchElementException 11-23 16:07:50.126: E/AndroidRuntime(24124): at java.util.ArrayList$ArrayListIterator.next(ArrayList.java:572) 11-23 16:07:50.126: E/AndroidRuntime(24124): at com.xxx.xxx.xxx.RouteOverlay.redrawPath(RouteOverlay.java:90) 11-23 16:07:50.126: E/AndroidRuntime(24124): at com.xxx.xxx.xxx.RouteOverlay.draw(RouteOverlay.java:60) 11-23 16:07:50.126: E/AndroidRuntime(24124): at com.google.android.maps.Overlay.draw(Overlay.java:179) 11-23 16:07:50.126: E/AndroidRuntime(24124): at </code></pre> <p>Etc ...</p> <p>Line Error (RouteOverlay.java) :</p> <pre><code> prj.toPixels(it.next(), p); </code></pre> <p>On :</p> <pre><code> private void redrawPath(final MapView mv) { final Projection prj = mv.getProjection(); path.rewind(); final Iterator&lt;GeoPoint&gt; it = routePoints.iterator(); //Crash Here prj.toPixels(it.next(), p); path.moveTo(p.x, p.y); while (it.hasNext()) { prj.toPixels(it.next(), p); path.lineTo(p.x, p.y); } path.setLastPoint(p.x, p.y); } </code></pre> <p>Thanks .</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload