简体   繁体   中英

Android Google Maps api v2 stops loading tiles

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM