【发布时间】:2012-06-30 13:26:47
【问题描述】:
我正在尝试获取特定地理点的地址,但是当我尝试使用 try 并捕获它时失败。这是我的代码
srcGeoPoint = new GeoPoint((int) (src_lat * 1E6),(int) (src_long * 1E6));
Geocoder geocoder=new Geocoder(getBaseContext(), Locale.getDefault());
try
{
List<Address> addresses=geocoder.getFromLocation(srcGeoPoint.getLatitudeE6()/1E6,
srcGeoPoint.getLongitudeE6()/1E6,1);
String add="";
if(addresses.size()>0)
{
for (int i=0; i<addresses.get(0).getMaxAddressLineIndex();
i++)
add += addresses.get(0).getAddressLine(i) + "\n";
}
tv.setText(add);
}
catch(IOException e)
{
e.printStackTrace();
}
在这条线上失败了 列出地址=geocoder.getFromLocation(srcGeoPoint.getLatitudeE6()/1E6, srcGeoPoint.getLongitudeE6()/1E6,1); 有什么帮助吗??
【问题讨论】:
-
这在模拟器上很常见。你在真机上试过了吗?
-
还没有,但我使用的是静态地理点,为什么它不显示地址?
标签: android google-maps reverse-geocoding