2014-09-22 54 views

回答

0
 utf8s = location.getBytes("UTF-8"); 
     String place = new String(utf8s, "UTF-8"); 
     place = place.trim().replace(" ", "+"); 

     HttpGet request = 
     new HttpGet("https://maps.googleapis.com/maps/api/geocode/json?address="+place+",+CA&key=AIzaSyAXDKR0cSN7kp4tfuUspGZt-zTW5IAa6hM"); 

     result = httpclient.execute(request, handler); 
     JSONObject response = new JSONObject(result); 
     JSONObject geometry = response.getJSONArray("results").getJSONObject(0).getJSONObject("geometry"); 

     JSONObject location= geometry.getJSONObject("location");