地理coder.getFromLocation抛出异常 [英] Geocoder.getFromLocation throws Exception
问题描述
可能重复:
<一href="http://stackoverflow.com/questions/5205650/geo$c$cr-getfromlocation-throws-ioexception-on-android-emulator">Geo$c$cr.getFromLocation抛出IOException异常在Android模拟器
我使用谷歌API 7,Android2.1的模拟器
I am using Google api 7, Android2.1 emulator
我试图做反向地理编码和我:
I am trying to do reverse geocoding and I get:
03-07 16:19:42.661:WARN / System.err的(261):产生java.io.IOException:无法解析来自服务器的响应
03-07 16:19:42.661: WARN/System.err(261): java.io.IOException: Unable to parse response from server
在该行:
List<Address> addresses = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), 1);
任何想法?
谢谢, 射线。
推荐答案
请注意,当你调用该方法,它触发了一个API调用谷歌地图服务器 - 它不是在设备上这样做。我怀疑这是一个错误,你将看到有时,因为该方法不管理,以获得从谷歌地图API的一个有意义的反应。我用这个方法,我偶尔会看到错误,但我通常把方法变成10重试循环,静静地忽略偶尔的错误。如果它发生在每次调用该方法时,有一些奇怪的事情发生。
Do note that when you call that method, it fires off an API call to Google Maps' servers - it isn't doing it on the device. I suspect this is an error you will see sometimes, because the method is not managing to get a meaningful response from the Google Maps API. I've used this method and I occasionally see that error, but I usually put the method into a loop of 10 retries, and quietly ignore the occasional error. If it's happening every time you call the method, there's something odd happening
这篇关于地理coder.getFromLocation抛出异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!