This post is in addition to:
http://groups.google.com/group/android-developers/browse_thread/thread/1459f065d3af1a5e

I have exactly the same problem and Doug pinpointed what's probably
the issue in my case exactly:

So here's the deal: I have a Vector containing traffic messages
(received from a server via UDP in an own thread). Each time a message
is received, I create a new overlay object and populate it with the
traffic messages:

public void receiveMessage(BinaryMessage binaryMsg) {

                ....
             TrafficMessage message = createMessage(binaryMsg);
             // adds message to vector
             addTrafficMessage(message,
CoCarMapView.trafficMessages);
             CoCarMapView.showTrafficMessages();
                                ....
}

public static void showTrafficMessages() {
                List<Overlay> overlays = mapView.getOverlays();
                if (overlays.size() > 1) {
                        overlays.remove(1);
                }
                Drawable warningIcon = context.getResources().getDrawable
(R.drawable.sign_warning_small);
                CoCarItemizedOverlay trafficEventsOverlay = new 
CoCarItemizedOverlay
(warningIcon);

                // the overlay is populated here
                trafficEventsOverlay.updateOverlay(trafficMessages);

                mapView.getOverlays().add(trafficEventsOverlay);
                mapView.postInvalidate();
}

public void updateOverlay(Vector<TrafficMessage> messages) {
                for(int i=0; i < messages.size(); i++) {

                        TrafficMessage message = messages.elementAt(i);
                        Drawable messageIcon = getMessageIcon(message);
                        GeoPoint point = getGeoPoint(message);
                        OverlayItem messageItem = createItem(messageIcon, 
point);
                        this.addItem(messageItem);

                }
}


I don't understand yet exactly where the error is caused, that is
where to start improving stuff...

Thanks for your advice,

Lex

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to