Note that there are some explanatory texts on larger screens.

plurals
  1. PONot getting KML file as response
    primarykey
    data
    text
    <p>I am creating an application where I have to post to this url: <a href="https://maps.google.com/maps?saddr=22.583375060000,88.434077990000&amp;daddr=22.491368100000,88.348189300000&amp;ie=UTF8&amp;0&amp;om=0&amp;output=kml" rel="nofollow">Url to get KML</a></p> <p>The url is supposed to return a KML file, according to this tutorial:</p> <p><a href="http://blog.synyx.de/2010/06/routing-driving-directions-on-android-part-1-get-the-route/" rel="nofollow">Tutorial link</a></p> <p>But when I am hitting the url, I am getting a <strong>HTML</strong> file as a response which is very difficult to parse and is useless.</p> <p><strong>My source code is:</strong></p> <pre><code>//Calling function to get the response KML getKmlFromUrl("https://maps.google.com/maps?saddr=22.583375060000,88.434077990000&amp;daddr=22.491368100000,88.348189300000&amp;ie=UTF8&amp;0&amp;om=0&amp;output=kml"); </code></pre> <p>//This is the function to get the KML file and show it in logcat void getKmlFromUrl(String urlString) { String kml = null;</p> <pre><code> try { // defaultHttpClient DefaultHttpClient httpClient = new DefaultHttpClient(); makeAToast("URL:"+urlString); HttpPost httpPost = new HttpPost(urlString); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); kml = EntityUtils.toString(httpEntity); System.out.println("KML: "+kml); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } // // return XML // // return xml; } </code></pre> <p>After doing all these, I am not getting a <strong>KML</strong> response, instead I am getting an <strong>HTML</strong> response. The response (in logcat) is over here:</p> <p><a href="http://justpaste.it/1ido" rel="nofollow">logcat output</a> </p> <p>Where am I going wrong?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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