我如何在模拟器中测试地理编码应用程序

发布于 2024-12-21 11:04:10 字数 791 浏览 5 评论 0原文

我正在开发应用程序,我想在其中使用地理编码,但是当我使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

故事灯 2024-12-28 11:04:10

如果您使用的是 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..

转身泪倾城 2024-12-28 11:04:10

当您使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文