xml - How to use Google Places API in Android? -
i know url of accessing google places. check here
but not able parse data coming url in xml format. so, tell me mechanism display data coming google places api in xml format.
please tell me sample code or tutorial it.
thanks in advance
you can parse json.
if see url contains xml here . this give response in xml.
output xml:
<placesearchresponse> <status>request_denied</status> </placesearchresponse> just replace json this . this give response in json.
output json:
{ "html_attributions" : [], "results" : [], "status" : "request_denied" } see this-blog further
for parsing
try { httppost httppost = new httppost("https://maps.googleapis.com/maps/api/place/search/json?&location=17.739290150000002,83.3071201&radius=6000&names=hospital&sensor=true&key=yourkeyhere"); httpclient httpclient = new defaulthttpclient(); response = httpclient.execute(httppost); string data = entityutils.tostring(response.getentity()); system.out.println(data); //parse json, gson, jackson } catch (exception e) { e.printstacktrace(); }
Comments
Post a Comment