将得到的经纬度传入谷歌接口即可获一段json数据
解析json获得你需要的字段
用的xutils
//http://maps.google.cn/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=true&language=zh-CN
//获得地址
private void Dizhi(String lating) {
HttpUtils http = new HttpUtils();
RequestParams params = new RequestParams();// "/storage/sdcard0/MyPicture/1435657066760.jpg"
params.addQueryStringParameter("latlng",lating);//经纬度40.714224,-73.961452//注意经纬度不要写反了可利用百度坐标拾取工具获得百度是反的
params.addQueryStringParameter("sensor","true");
params.addQueryStringParameter("language","zh-CN");
http.send(HttpMethod.POST,
"http://maps.google.cn/maps/api/geocode/json",params,
new RequestCallBack<String>() {
@Override
public void onFailure(HttpException arg0, String arg1) {
}
@Override
public void onSuccess(ResponseInfo<String> responseInfo) {
MapAddress address=GsonUtils.json2Bean(responseInfo.result,MapAddress.class);
if (address.status.equals("OK")) {
Log.i("cvcv",address.results.get(0).formatted_address);
}
}
});
}