I'm programming an app for android, in which i have to represent certain block facades. For this purpose, i draw a polyline for each relevant block facade (very simple polylines, 2 point lines actually...).
Worst case scenario, there could be up to 100k polylines.
My problem is that i'm running tests with about 3000 lines and it's already really slow. I have no problem with getting the data to show, and no problem drawing the lines, but the map becomes laggy when more than 1k lines are drawn.
I create a PolylineOptions for each polyline, and then draw it and store it in a variable like this:
PolylineOptions options = new PolylineOptions();
options.add(latlon1, latlon2);
options.width(5);
options.color(Color.RED);
Polyline myPolyline = map.addPolyline(options);
myPolyline.setVisible(true);
myPolylines.add(myPolyline);
I tried not storing them (though this is necessary for later processing) in case it was a memory issue, but didn't make a difference... Also, when storing them, the rest of the app works fluently (some extra buttons/text fields), it's just the map that becomes slow (when moving/zooming).
Oh, and I'm using mapfragment class of google maps api v2.
So, the question being: Is there any way to improve the map performance?
Thanks in advance.
EDIT: The polylines are all visible at once. To avoid drawing unnecessary lines I added a "previous step" in which i draw circles that represent the amount of facades with the fill color (green to red) and only show the lines when a circle is selected and the user asks for the detailed view.
EDIT2: Here's what i'm trying to accomplish (it's from a mapguide map, but i'm trying to replicate on android)