Performance of map overlay in conjunction with ItemizedOverlay is very poor
Posted
by oviroa
on Stack Overflow
See other posts from Stack Overflow
or by oviroa
Published on 2010-04-14T14:40:17Z
Indexed on
2010/04/14
14:43 UTC
Read the original article
Hit count: 323
I am trying to display one png (drawable) on a map in about 300 points. I am retrieving the coordinates from a Sqlite table, dumping them in a cursor. When I try to display them by parsing through the cursor, it takes for ever for the images to be drawn, about .5 second per image. I find that to be suspiciously slow, so some insight on how I can increase performance would help. Here is the snippet of my code that does the rendering:
while (!mFlavorsCursor.isAfterLast())
{
Log.d("cursor",""+(i++));
point = new GeoPoint(
(int)(mFlavorsCursor.getFloat(mFlavorsCursor.getColumnIndex(DataBaseHelper.KEY_LATITUDE))*1000000),
(int)(mFlavorsCursor.getFloat(mFlavorsCursor.getColumnIndex(DataBaseHelper.KEY_LONGITUDE))*1000000));
overlayitem = new OverlayItem(point, "", "");
itemizedoverlay.addOverlay(overlayitem);
itemizedoverlay.doPopulate();
mFlavorsCursor.moveToNext();
}
mapOverlays.add(itemizedoverlay);
I tried to isolate all the steps and it looks like the slow one is this:
itemizedoverlay.doPopulate();
This is a public method in my class that extends ItemizedOverlay that runs the private populate() method.
© Stack Overflow or respective owner