views:

99

answers:

1

I have a scrollable and zoomable map which has a low res copy of the map which is drawn when the zoom scale is small and a tile system when the user zooms in past a certain point. The problem im having is that the very first time the tiles are drawn there is a short, but noticable lag. After that initial lag everything is smooth. The GC isnt running, and all the bitmaps are loaded at launch time. Any idea what exactly is going on so i can take care of the lag? Or any way for a work around? Thanks. Heres the code below:

            canvas.drawBitmap(map, null, bgRect,paint);

            if(matrix[0]>.9){
                 mapPicture = makeMyMap(xScale,yScale); //make/update our map.
                 mapPicture.draw(canvas);  
            }
A: 

Try switching on tracing with DDMS to establish which methods take a long time on the first draw and see how they compare with the subsequent draws.

It's possible that drawBitmap is triggering the platform level up-scale / down-scale of the images on first draw rather than load - but that's speculation on my part.

Colin Stewart