On 6/29/2010 3:12 PM, Steve Howard wrote:
I think some of the confusion might be coming from the fact that you're expecting too much high-level logic from ItemizedOverlay. ItemizedOverlay is a pretty basic class. You override size() and createItem() to do whatever you want, and then you call populate() anytime you want to update the items in the overlay. populate() will call size() to figure out how many items are present, then call createItem() once for each index 0 - [size() - 1].

How size() and createItem() work, and when populate() gets called, are up to you. From your description, one possibility might be something like this:

* Detect map movements by adding an empty Overlay and overriding the draw() method. Use a delay timer to trigger an update after the map stops moving for some threshold of time. * Upon update, get the lat/long span of the MapView, as described, and use it to query your database/server/whatever. * When the results arrive, use them to fill in a member List on your ItemizedOverlay subclass. Then call populate(). Your size() method returns the length of the List; your createItem generates OverlayItems from the data in that List.

It's a bit convoluted, no doubt -- some sample code would probably be well-received here. Nonetheless, such an implementation should be possible today.

<http://groups.google.com/group/android-developers?hl=en>
Thanks Steve! Ultimately, I ended up doing something very similar to this, primarily based around onTouchEvent() in my ItemizedOverlay class.

Raymond

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