谷歌地图使用叠加层非常慢
我有一个 MapView,在其中放置了一些 ca. 200 个叠加,全部具有相同的图片。我用 Restlet 获取位置数据。但这不应该是问题,因为我获取数据的速度足够快。
问题是,MapView 非常慢。性能会随着覆盖层的数量而降低,但它不应该降低,因为在 iPad 上,有一个应用程序可以轻松做到这一点。我的平板电脑有更多 Ghz。 即使我没有在平板电脑上滚动,平板电脑也会一次又一次地加载地图的某些部分。
所以我认为我做错了什么。所以我有一些问题:
LogCat 说:
GC_CONCURRENT 释放了 287K,释放了 6% 7222K/7623K,暂停了 1ms+2ms
并重复此操作,试图不断获得一些空间。是否有可能这就是问题所在,缓存填充太多?叠加层的阴影是否可能会消耗相当多的性能?我怎样才能删除它们?
如何通过按后退按钮删除所有数据?我必须在
onStop()
和onDestroy()
中插入什么?据我所知,垃圾收集器会自动完成所有这些工作。我还能做什么?删除叠加层?我使用的案例如下:
minLatitude = (minLatitude > 合作伙伴Latitude) ?合作伙伴纬度:最小纬度;
和每个:
for(BrunnerPartner 合作伙伴:查询) { PartnerAL.add(合作伙伴); }
这些对性能有害吗?
如果我在缩放范围较小时隐藏一些叠加层,会对我有帮助吗?我该如何做到这一点?
I have a MapView in which I place some ca. 200 Overlays, all with the same picture. I get the location-data with Restlet. But that shouldn't be the problem, because I get the Data fast enough.
The problem is, that the MapView is very slow. The performance decreases with the count of the Overlays, but it shouldn't, cause on the iPad, there's an app, which can do this easily. My Tablet has even more Ghz.
The Tablet is loading parts of the map again and again, even when I don't scroll on it.
So I think that I'm doing something wrong. So I have some questions:
LogCat says:
GC_CONCURRENT freed 287K, 6% free 7222K/7623K, paused 1ms+2ms
and repeats this, trying to get some space continuously. Is it possible that this is the problem and the cache filled too much?Is it possible that the shadow of the Overlays costs pretty much performance? How can I delete them?
How can I delete all the data with pressing the back button? What do I have to insert into
onStop()
andonDestroy()
? As I know, the Garbage Collector is doing all this stuff automatically. What else could I do? Remove Overlays?I use cases like:
minLatitude = (minLatitude > partnerLatitude) ? partnerLatitude : minLatitude;
and for-each:
for(BrunnerPartner partner: query) { partnerAL.add(partner); }
Are these bad for performance?
Would it help me if I would hide some Overlays when the zoom span is small? How could I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看一下 OverlayItem 示例: http://developer.android.com /resources/tutorials/views/hello-mapview.html
使用单独的叠加层会导致大量的膨胀。
Take a look at the OverlayItem example: http://developer.android.com/resources/tutorials/views/hello-mapview.html
Using individual overlays introduces a large amount of bloat.