getfromlocation始终返回ioexception。我有一个互联网许可,在2.3设备和4.0设备中尝试模拟器。总是相同的结果。
这是代码
while (it.hasNext()) {
Tienda temp = (Tienda) it.next();
double latitud = Double.parseDouble(temp.latitud.toString());
double longitud = Double.parseDouble(temp.longitud.toString());
nombre = temp.nombre;
GeoPoint punto = new GeoPoint((int)(latitud*1e6), (int)(longitud*1e6));
try {
Geocoder geocoder = new Geocoder(this, Locale.getDefault());
List<Address> addresses = geocoder.getFromLocation(latitud, latitud, 1);
StringBuilder sb = new StringBuilder();
if (addresses.size() > 0)
{
Address address = addresses.get(0);
sb.append(address.getLocality()).append("\n");
sb.append(address.getCountryName());
}
addressString = sb.toString();
Log.e("Address from lat,long ;", addressString);
}catch (IOException e){
}
CustomOverlayItem overlayItem = new CustomOverlayItem(punto, nombre,addressString,"http://ia.media-imdb.com/images/M/MV5BMTM1MTk2ODQxNV5BMl5BanBnXkFtZTcwOTY5MDg0NA@@._V1._SX40_CR0,0,40,54_.jpg");
itemizedOverlay.addOverlay(overlayItem);
mapOverlays.add(itemizedOverlay);
}
我尝试使用不同的代码,但是没有工作..