Peter wrote:
Do you populate each of the Overlays in the ArrayList?
In order to add new OverlayItems to our ArrayList, we need a new public
method. We'll handle this with the following method:
public void addOverlay(OverlayItem overlay) {
mOverlays.add(overlay);
populate();
}
Each time we add a new OverlayItem, we must call |populate()|, which
will read each of out OverlayItems and prepare them to be drawn.
Samson Sequeira wrote:
> Is there a limit to the number of Overlays that can be added to a Map?
>
> My application works fine when I add two overlays, but fails for more
> than two. This is a part of my code
>
> for (int index=0;index<listOfGeopoints.size();index++){
> if (color.get(index)==100){
> overlayitem = new OverlayItem(listOfGeopoints.get(index),
> "", "");
> itemizedOverlay1.addOverlay(overlayitem);}
>
> else if (color.get(index)==75){
> overlayitem = new OverlayItem(listOfGeopoints.get(index),
> "", "");
> itemizedOverlay2.addOverlay(overlayitem);}
>
> else if (color.get(index)==50){
> overlayitem = new OverlayItem(listOfGeopoints.get(index),
> "", "");
> itemizedOverlay3.addOverlay(overlayitem);}
>
> else {
> overlayitem = new OverlayItem(listOfGeopoints.get(index),
> "", "");
> itemizedOverlay4.addOverlay(overlayitem);}
> }
>
> mapOverlays.add(itemizedOverlay1);
> mapOverlays.add(itemizedOverlay2);
> mapOverlays.add(itemizedOverlay3);
> mapOverlays.add(itemizedOverlay4);
>
>
> Any ideas as to why this is happening?
>
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en