Ok, time to ask, I've searched, tried things suggested, and have spent
a day on this to no avail. Any suggestions gratefully received. I am
using the mapview tutorial as a base and I can only get ONE marker/
location to show up - the one in Mexico, another off of Cape Cod, but
not both!  (I checked the data on the locationlist array and it is
there with different lat/lons as ints)




public class LocationMapView extends MapActivity
// implements LocationListener
{
        List<Overlay>    mapOverlays;
        Drawable         drawable;
        MapView          mapView;
        PointLocation [] locationlist ;
        GeoPoint         point    ;
        OverlayItem      overlayitem ;
        LocationItemizedOverlay itemizedOverlay ;

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.maplayout);
        mapView = (MapView) findViewById(R.id.mapview);
        mapView.setBuiltInZoomControls(true);
        mapView.setStreetView(true);

        LocationDb mLocationDb = new LocationDb();
        mLocationDb.open();
        locationlist =  mLocationDb.fetchLocations() ;

        mapOverlays = mapView.getOverlays();
        drawable = this.getResources().getDrawable
(R.drawable.androidmarker);

        point = new GeoPoint(locationlist[0].geolat, locationlist
[0].geolon) ;
        overlayitem = new OverlayItem(point, "", "");
        itemizedOverlay = new LocationItemizedOverlay(drawable);
        itemizedOverlay.addOverlay(overlayitem);

        point = new GeoPoint(locationlist[1].geolat, locationlist
[1].geolon) ;
        overlayitem = new OverlayItem(point, "", "");
        itemizedOverlay = new LocationItemizedOverlay(drawable);
        itemizedOverlay.addOverlay(overlayitem);

        mapOverlays.add(itemizedOverlay);




and  ItemizedOverlay.java is-


import android.graphics.drawable.Drawable;
import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.OverlayItem;
import java.util.ArrayList;

public class LocationItemizedOverlay extends ItemizedOverlay
{

        private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>
();

        public LocationItemizedOverlay(Drawable defaultMarker)
        {
                super(boundCenterBottom(defaultMarker));
                // TODO Auto-generated constructor stub
        }

        @Override
        public int size() {
                // TODO Auto-generated method stub
                return mOverlays.size();
        }
        public void addOverlay(OverlayItem overlay) {
            mOverlays.add(overlay);
            populate();
        }

        @Override
        protected OverlayItem createItem(int i)
          {
          return mOverlays.get(i);
          }









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