我正在尝试获取特定地理点的地址,但是当我尝试使用 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();
}
它在这一行失败 List addresses=geocoder.getFromLocation(srcGeoPoint.getLatitudeE6()/1E6, srcGeoPoint.getLongitudeE6()/1E6,1); 有什么帮助吗??