Android Google Maps api v2 stops loading tiles

人走茶凉 提交于 2019-12-21 22:10:11

问题


Upon loading the fragment it loads initial tiles. After that, it stops loading more detailed tiles automatically as the map moves according to GPS position. If I swipe the map it'll load all additional tiles. At some point I'll get past the point where it had loaded tiles and I'll have to swipe the screen to download more detailed tiles. I've added android:heapLarge="true" to the manifest, but that doesn't solve the issue. http://i60.tinypic.com/rr8sd1.png

Edit: I've figured out why this was happening. I had set the animation time to 1 second to smooth it out. This doesn't allow the map to stop, which is required in order to update and load new tiles. Since I've changed it to 900 ms the map stops for a tenth of a second and loads the necessary tiles.


回答1:


I've seen this before in another question can't find that question today :( Solution You have to let the map breathe so to speak. Meaning you can't do continuous moves of the map. Because the map interaction is done on the UI thread what happens is the UI thread gets clogged and actually everything UI will stop working in your app.

The code below sends updates every N seconds and moves the map with an animation. It's nice has a non jerk move to it. Simply copy the class to your project and start moving the map.

https://github.com/danny117/MapMover



来源:https://stackoverflow.com/questions/25915213/android-google-maps-api-v2-stops-loading-tiles

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!