我如何在模拟器中测试地理编码应用程序
我正在开发应用程序,我想在其中使用地理编码,但是当我使用 goecode
List<Address> addresses = geocoder.getFromLocation(12.33,102.44, 1);
if (addresses != null && addresses.size() > 0) {
Address address = addresses.get(0);
// sending back first address line and locality
result = address.getAddressLine(0) + ", " + address.getLocality();
Toast.makeText(this, result,Toast.LENGTH_SHORT);
Logcat 显示 ioexception 时,如下所示
12-17 11:50:55.367: WARN/System.err(339): java.io.IOException: Service not Available
12-17 11:50:55.377: WARN/System.err(339): at android.location.Geocoder.getFromLocation(Geocoder.java:136)
,我没有 Android 设备,所以我想在模拟器中检查这一点,如何解决问题?
i am developing application in which i want to use geocoding ,but when i using goecode
List<Address> addresses = geocoder.getFromLocation(12.33,102.44, 1);
if (addresses != null && addresses.size() > 0) {
Address address = addresses.get(0);
// sending back first address line and locality
result = address.getAddressLine(0) + ", " + address.getLocality();
Toast.makeText(this, result,Toast.LENGTH_SHORT);
Logcat showing ioexception as follows
12-17 11:50:55.367: WARN/System.err(339): java.io.IOException: Service not Available
12-17 11:50:55.377: WARN/System.err(339): at android.location.Geocoder.getFromLocation(Geocoder.java:136)
i have no android device,so i want to check this in emulator,how can resolve the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用的是 android 2.2 那么这是 2.2 模拟器中的一个错误
http://code.google.com/p/android/issues/detail ?id=8816
在我看来,这是模拟器的问题... getFromLocationName 方法似乎在设备上工作得很好。
If you are using android 2.2 then It's a bug in the emulator for 2.2
http://code.google.com/p/android/issues/detail?id=8816
It seems to me that this is a problem with the emulator... The getFromLocationName method seems to work just fine on the devices..
当您使用 Google API 19 的目标构建 avd 并使用 Google API 19 构建应用程序目标时,反向地理编码 getFromLocation 方法可以正常工作。
reverse geocodeing getFromLocation method works fine when you build avd with the target as Google API 19 and also build the application target with the Google API 19.