android - How to get lat and longtitude values out from google places details result -
i have returns result of place details code below:
private placedetails getplacedetails(string url) throws exception{ string jsonresults =null; httphelper helper = new httphelper(); try { jsonresults = helper.getjsonstring(url); // create json object hierarchy results jsonobject jsonobj = new jsonobject(jsonresults.tostring()).getjsonobject("result"); placedetails = new placedetails(); placedetails.setname(jsonobj.getstring("name")); placedetails.setformatted_address(jsonobj.getstring("formatted_address")); placedetails.setinternational_phone_number(jsonobj.getstring("international_phone_number")); } catch (jsonexception e) { log.e("log_tag", "error processing json results " + e.getmessage().tostring(), e); } return placedetails; }
now, problem dont know how lat , lng values out of result.
thanks in advance.
in response lat lon
"geometry" : { "location" : { "lat" : -33.8669710, "lng" : 151.1958750 }
you have parse data using jsonarray this
jsonobj.getjsonarray("geometry");
you can refer link http://yuvislm.wordpress.com/2012/09/10/google-places-api-and-json-parsing-in-android/ complete code
Comments
Post a Comment