ItemizedOverlays ever managed to use ItemizedOverlays in Android Beta 0.9? I can't get it to work, but I'm not sure I did something wrong or this feature is not yet available.
I tried using ItemizedOverlay and OverlayItem . Their purpose is to simulate map markers (as seen in Google Maps Mashups), but I had problems displaying them on the map.
I can add my own custom overlays using a similar technique, ItemizedOverlays just don't work.
After I implemented my own ItemizedOverlay (and redefined createItem ), it seems that creating a new instance of my class works (I can extract OverlayItems from it), but adding it to the Overlay list of the map does not make it look like this as it should.
This is the code that I use to add the ItemizedOverlay class as Overlay to my MapView .
Where MyItemizedOverlay is defined as:
public class MyItemizedOverlay extends ItemizedOverlay<OverlayItem> { public MyItemizedOverlay(Drawable defaultMarker) { super(defaultMarker); populate(); } @Override protected OverlayItem createItem(int index) { Double lat = (index+37.422006)*1E6; Double lng = -122.084095*1E6; GeoPoint point = new GeoPoint(lat.intValue(), lng.intValue()); OverlayItem oi = new OverlayItem(point, "Marker", "Marker Text"); return oi; } @Override public int size() { return 5; } }
java android overlay android-mapview
Reto Meier Aug 25 '08 at 16:39 2008-08-25 16:39
source share