I am working on a map of my public transport application. I use SurfaceView, this is a tile-based map, there are 2 streams, besides the main stream - the drawing stream and the loading stream of bitmap images.
Raster images - 256x256 PNG stored on an SD card, I cache downloaded raster images, cache capacity - 64 bit cards. There are different sets of bitmap images for each zoom level, my map has 4 zoom levels, each next level is 2 times enlarged.
Unfortunately, scrolling and zoom zoom are not smooth on my Nexus One, FPS is 15-20. If no tiles are loaded, FPS is 35–40. If I lower the priority of the bitmap download stream, it becomes completely smooth, but I often see unloaded (white) tiles on the map - which is even worse than nonsmoothness.
So what could I do? So far I have 2 ideas:
- Try OpenGL, but I don’t want to waste time on it, and then I find out that my FPS is only increased by 3. Also I want to show pop-ups (which scroll using the map) after the user clicks on the map markers, which I don’t know how to do this in GLSurfaceView.
- Set a low priority to download a streaming image only when the user touches the screen or when there is an ongoing animation. I tried this, but for some unknown reason, it even made the problem a little worse, touching / not touching the screen had no effect. If this was some kind of error that I can fix, there is another problem. If I use a kinetic scroll to quickly move the map, I will see a lot of uncached bitmaps.
source
share