Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Process the following URL to get Locations between the source and destination coordinates</p> <pre><code>StringBuilder urlString = new StringBuilder(); urlString.append("http://maps.google.com/maps/api/directions/xml?origin="); urlString.append( Double.toString((double)srcGeoPoint.getLatitudeE6()/1.0E6 )); urlString.append(","); urlString.append( Double.toString((double)srcGeoPoint.getLongitudeE6()/1.0E6 )); urlString.append("&amp;destination=");//to urlString.append( Double.toString((double)destGeoPoint.getLatitudeE6()/1.0E6 )); urlString.append(","); urlString.append( Double.toString((double)destGeoPoint.getLongitudeE6()/1.0E6 )); urlString.append("&amp;sensor=true&amp;mode=driving"); </code></pre> <p>After getting response from above URL Encode the string with following method</p> <pre><code>private List&lt;GeoPoint&gt; decodePoly(String encoded) { List&lt;GeoPoint&gt; poly = new ArrayList&lt;GeoPoint&gt;(); int index = 0, len = encoded.length(); int lat = 0, lng = 0; while (index &lt; len) { int b, shift = 0, result = 0; do { b = encoded.charAt(index++) - 63; result |= (b &amp; 0x1f) &lt;&lt; shift; shift += 5; } while (b &gt;= 0x20); int dlat = ((result &amp; 1) != 0 ? ~(result &gt;&gt; 1) : (result &gt;&gt; 1)); lat += dlat; shift = 0; result = 0; do { b = encoded.charAt(index++) - 63; result |= (b &amp; 0x1f) &lt;&lt; shift; shift += 5; } while (b &gt;= 0x20); int dlng = ((result &amp; 1) != 0 ? ~(result &gt;&gt; 1) : (result &gt;&gt; 1)); lng += dlng; GeoPoint p = new GeoPoint((int) (((double) lat / 1E5) * 1E6), (int) (((double) lng / 1E5) * 1E6)); poly.add(p); } return poly; } </code></pre> <p>after encode the between locations you draw path using canvas drawing .</p> <p>NOTE: FOR Voice Route you may use TTS(Text To Speech)</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