Hi, Same problem here. I added two items and I found out that even the draw() method from ItemizedOverlay is called but there is nothing on my map view. My code is quite equal to yours.
On 25 Aug., 18:29, Reto <[EMAIL PROTECTED]> wrote: > I've been trying to use the ItemizedOverlay and OverlayItem classes in > the 0.9 Beta to simulate map markers but have been having some > problems getting it to display on the map. > > Once I've implemented my own ItemizedOverlay (and overriden > createItem), creating a new instance of my class seems to work (I can > extract OverlayItems from it) but adding it to the overlay list for > one of my maps doesn't seem to do anything. > > I've included the code for adding the ItemizedOverlay to the map, and > the ItemizedOverlay implementation itself is also included. Have I > done something wrong or is this functionality not yet available? > > // Add the ItemizedOverlay to the Map > private void addItemizedOverlay() { > Resources r = getResources(); > mapView = (MapView)findViewById(R.id.map_view); > List<Overlay> overlays = mapView.getOverlays(); > > MyItemizedOverlay markers = new > MyItemizedOverlay(r.getDrawable(R.drawable.icon)); > overlays.add(markers); > > OverlayItem oi = markers.getItem(0); > markers.setFocus(oi); > mapView.postInvalidate(); > > } > > 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; > } > > } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new Android 0.9 SDK beta! http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---