【发布时间】:2022-02-15 20:05:20
【问题描述】:
我正在尝试将纬度和经度转换为地址。当我使用WIFI时,我得到了正确的答案。但是当我尝试使用 3G/LTE 时,我得到了错误:
等待服务器响应超时。
我在调试模式下发现了这一点。但为什么?我正在使用相同的信息(纬度,经度)。我该如何解决?这是我的功能
public void convert_adresses (double lat , double lng) throws IOException
{
addresses = geocoder.getFromLocation(lat, lng, 1);
address = addresses.get(0).getAddressLine(0);
city = addresses.get(0).getAddressLine(1);
country = addresses.get(0).getAddressLine(2);
txt_street.setText(address);
txt_city.setText(city);
txt_country.setText(country);
}
我这样称呼它:
try {
convert_adresses(latitude,longtitude);
} catch (IOException e) {
e.printStackTrace();
}
有人有想法吗?
【问题讨论】: