Android MapView 部分加载图块
我已经构建了一个具有单个地图视图的 Android 应用程序。
我有一个错误,地图视图偶尔会丢失图块。地图视图并非完全空白,出现了一些图块,但不是全部。这里的所有答案都与 API 密钥或在一个应用程序中拥有多个地图视图的问题有关。这不是问题。
它是间歇性发生的,大约每五次我在清除应用程序中的所有数据后启动应用程序时就会发生一次。所以它是新安装中的典型现象。
它仅发生在 Android 2.2 设备(肯定是三星 Galaxy S)上,
请注意日志显示:
07-21 17:11:52.274: INFO/MapActivity(25951): Handling network change notification:CONNECTED
07-21 17:26:25.629: ERROR/MapActivity(26064): Couldn't get connection factory client
当图块无法加载放大和缩小或重新启动时,不会刷新图块。唯一的解决方案是转到“设置”->“管理应用程序”->[选择应用程序]->“清除数据”,然后重新启动应用程序。
有人以前见过这个并知道原因或解决方法吗?
干杯。
I have built an android application which has a single mapview.
I have a bug where the map view occasionally has missing tiles. The map view is not completely blank some tiles appear but not all of them. All the answers here relate to API Keys or issues with having multiple mapviews in one app. This is not the problem.
It occurs intermittently, approximately one in every five times I start the application after clearing all data out of the app. So its typical seen on new installations.
It only occurs on Android 2.2 devices (Samsung Galaxy S definately)
Note the logs show:
07-21 17:11:52.274: INFO/MapActivity(25951): Handling network change notification:CONNECTED
07-21 17:26:25.629: ERROR/MapActivity(26064): Couldn't get connection factory client
When the tiles fail to load zooming in and out or restarting does not refresh the tiles. Only solution is to go to Settings->Manage Applications->[select app]->Clear data then restart the app.
Anyone seen this before and know of the cause or workaround?
Cheers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我猜您可以看到部分图块,因此可能是您的互联网连接问题。
如果您尝试在模拟器中运行应用程序,请检查您的互联网连接是否在模拟器中显示 3G 图标,否则请检查设备。
我发现了与您相同的问题,因为当我连接时显示地图的某些部分,一段时间后我再次打开它,当时我没有互联网,所以我在地图上发现了第一次加载的部分图块。我已连接到互联网并重试,然后我的问题得到解决,地图显示正常。
I can guess that you can see partial tiles so may be your internet connection problem.
Check your Internet connection weather it displays 3G icon in emulator if you are trying to run your app in emulator else check in device.
I had found same problem as you because when I had connection some part of map displayed and after some time i had opened it again and at that time i had not internet so I had found partial tiles on map which was loaded at the first time.I had connect to internet and try again then my issue is solved map displays fine.
建议
以编程方式删除缓存
这是较容易的部分。您将需要手动删除与您的应用程序关联的所有数据库和文件。删除之前不要忘记关闭数据库和文件流。这是如果您必须清除缓存。
Suggestion
Deleting the cache programmatically
This is the easier part. You will have manually to delete all the databases and files associated with your application. Do not forget to close databases and streams to files before deleting. This is if it turns out that you have to clear the cache.
如果网络连接不正确,则可能会发生这种情况。我的意思是如果网络提供商方面有任何问题。这也发生在我身上。一段时间后运行该应用程序即可。我希望它可以解决问题。
It can happen if the network connection is not proper. I mean if there is any problem from network provider side. It happend for me too. Just run the app after some time. I hope it may solve problem.