android - Custom tile based map is slow -


i working on map public transit app. i'm using surfaceview, it's tile based map, there 2 threads besides main thread - drawing thread , bitmap loading thread.

bitmaps 256x256 pngs stored on sd card, caching loaded bitmaps, cache capacity 64 bitmaps. there different sets of bitmaps every zoom level, map has 4 zoom levels, every next level 2x more zoomed.

unfortunately scrolling , pinch zooming not smooth on nexus one, fps 15 - 20. when no tiles being loaded fps 35 - 40. if lower priority of bitmap loading thread, becomes smooth see not yet loaded (white) tiles on map - worse non-smoothness.

so do? have 2 ideas far:

  • try opengl, don't want spend time on , find out fps inreased 3. want show popups (that scroll map) after user clicks on map markers, don't know how in glsurfaceview.
  • set low priority bitmap loading thread when user touches screen or when there's ongoing animation. tried unknown reason seemed worsen problem little bit, touching / not touching screen didn't have effect. if bug can fix, there's still problem. if use kinetic scroll move map, see many not cached bitmaps.

don't any i/o on rendering thread. (how can using glsurfaceview , not using opengl way?)

i have written opengl tile-based map view , smooth butter on nexus 1 (not measured fps it's easily smooth maps app on iphone 4). trick move i/o off rendering thread, lower priorities of worker threads, , requestrender() @ end of current render if know another's going needed (such during pan or zoom), i.e. don't wait signalled thread. yell.com in market see in action (may uk-only though).


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -