How to make a mutable ItemizedOverlay
Posted
by
Hamy
on Stack Overflow
See other posts from Stack Overflow
or by Hamy
Published on 2010-01-16T04:13:02Z
Indexed on
2011/01/03
13:54 UTC
Read the original article
Hit count: 274
Hey all,
I would like to make a Google map overlay with changable pins. An easy way to visualize this would be to think of a near real time overlay, where the pins are constantly changing location.
However, I can't seem to think of a safe way to do this with the ItemizedOverlay. The problem seems to be the call to populate - If size() is called by some maps thread, and then my data changes, then the result when the maps call accesses getItem() can be an IndexOutOfBoundsException.
Can anyone think of a better solution than overloading populate and wrapping super.populate in a synchronized block?
Perhaps I could get better luck using a normal Overlay? The Itemized one seems to exist to manage the data for you, perhaps I am making a fundamental mistake by using it?
Thanks for any help, my brain is hurting!
Hamy
© Stack Overflow or respective owner