On Wed, Aug 17, 2011 at 10:57 PM, Danny D <[email protected]> wrote:

> I'm writing an application that will have lots of map points, using
> the Google Maps API.
>
> Which approach is best? Are there synchronization issues working with
> Overlays directly?
>
>
In general, it's best to manipulate the Android UI and its satellite objects
directly only from the application's main thread --- the UI isn't
thread-safe,
and if the user starts manipulating things while you're dinking UI data
structures on a background thread, things usually go south in a hurry.
(There are a bunch of ways to mediate communication between
background threads and UI updates --- the progress updates associated
with an AsyncTask, Activity#runOnUIThread, the Handler class, and so
forth.)

BTW, here's an old, but perhaps still relevant, thread with some other
relevant info about updating ItemizedOverlays:


http://groups.google.com/group/android-developers/browse_thread/thread/38b11314e34714c3

It seems that at least in older versions of the maps code, there are a
few quirks you need to be aware of.  (I haven't run into these, largely
by dint of doing things the dumb way --- replacing the ItemizedOverlay
on any change --- but I did at one point need to add calls to
MapView#invalidate to force overlay changes onto the display.)

rst

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