实现Geocoder时返回null
|
我正在尝试使用Geocoder查找地址(位置)。
我有以下代码:
double lat = (double) (coord.getLat() * (1e-6));
double lon = (double) (coord.getLon() * (1e-6));
try {
List<Address> list = geocoder.getFromLocation(lat, lon,1);
if (list != null && list.size() > 0) {
Address address = list.get(0);
result = address.getAddressLine(0) + \", \"
+ address.getLocality();
}
System.out.println(\"adresa returnata folosind geocoder:\"
+ result);
}
我传递给地址解析器的数据采用以下格式:
2.449548
48.950518
但是,当尝试将Geocoder返回的第一个地址设为“ 1”时,它将返回null。这是我的logcat的样子:
reverseGeocode()`:无功能
位置
我的System.out.println()
显示:null
。我的清单文件中添加了互联网访问权限和互联网权限。有人知道我在做什么错吗?
没有找到相关结果
已邀请:
1 个回复
豪抱怒掳