Peter Wrote
try adding a create method like this
This code reads a List of POI which come from a database
public WhatAroundMeOverlay( WhatAroundMe whatAroundMe,Drawable
defaultMarker,List<POI> listPOI ) {
super(defaultMarker);
this.whatAroundMe = whatAroundMe;
this.listPOI = listPOI;
Iterator<POI> iterator = listPOI.iterator();
while(iterator.hasNext()) {
POI location = iterator.next();
latitudeDouble = Double.valueOf(location.latitude) * 1E6;
longitudedouble = Double.valueOf(location.longitude) * 1E6;
geoPoint = new
GeoPoint(latitudeDouble.intValue(),longitudedouble.intValue());
mItemList.add(new OverlayItem(geoPoint , location.line0,
location.category));
}
populate();
}
@Override
protected OverlayItem createItem(int i) {
return mItemList.get(i);
}
indiabolbol.com wrote:
> How do I update a map dynamically either as the user moves the map.
>
> I tried to use the below code but the map does not display the data
> from server
>
> protected class SitesOverlay extends ItemizedOverlay<OverlayItem> {
> private List<OverlayItem> items = new ArrayList<OverlayItem>();
> private Drawable marker = null;
>
> public SitesOverlay(Drawable marker) {
> super(marker);
> this.marker = marker;
> populateFriends();
>
> }
>
> @Override
> protected OverlayItem createItem(int i) {
> return (items.get(i));
> }
>
> public synchronized void populateFriends() {
>
> // get it from server
> items = //Getting data from server here
>
> super.populate();
> }
>
> @Override
> public void draw(Canvas canvas, MapView mapView, boolean
> shadow) {
> super.draw(canvas, mapView, shadow);
> boundCenterBottom(marker);
> }
>
> @Override
> protected boolean onTap(int i) {
> showDialog(i);
> return (true);
> }
>
> @Override
> public int size() {
> return (items.size());
>
> }
> }
>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---