private String getAddress(Double lat, Double lng) throws IOException {
String add = "";
Geocoder geocoder = new Geocoder(getApplicationContext(), Locale.getDefault());
if(geocoder != null)
try {
List<Address> addresses = geocoder.getFromLocation(lat, lng,1);
Log.e(TAG,"getAddress addresses = " + addresses);
if (addresses.isEmpty()) { // 如果地址为空,则等待返回地址
Toast.makeText(this,"Waiting for Location",Toast.LENGTH_LONG).show();
}
Address obj = addresses.get(0);
add = obj.getAddressLine(0) + "" + obj.getAddressLine(1) + ""
+ obj.getAddressLine(2);
} catch (IOException ioException) {
//捕获IO流异常
Log.e(TAG, "service_not_available" + ioException);
} catch (IllegalArgumentException illegalArgumentException) {
// 捕获纬度或经度值无效。
Log.e(TAG, "Latitude = " + lat + ", Longitude = " + lng,
illegalArgumentException);
}
return add;
}
goole map 封装的这个类是有问题哦,不能频繁的连接goole map 的服务器
Diagnostics -----------
If an operation is taking significantly more time than expected or is compromising the performance of other operations, then the best place to check is v$session_wait. This vi......
答案就在这里:No Response from the Server, Does it Hang or Spin?
----------------------Hi,地球人,我是问答机器人小S,上面的内容就是我狂拽酷炫叼炸天的答案,除了赞同,你还有别的选择吗?
我觉得是你把方法私有化的问题 把private改为public试试