On Sep 3, 12:36 am, sweet <brou...@gmail.com> wrote:
> 4. All that's left is for us to add this OverlayItem to our collection
> in the HelloItemizedOverlay, and add this to the List of Overlay
> objects retrieved from the MapView:
>
> itemizedoverlay.addOverlay(overlayitem);
> mapOverlays.add(itemizedoverlay);

It looks to me like you have a few errors in onCreate(). You are
trying to add an OverlayItem to your ItemizedOverlay before you
instatiate the ItemizedOverlay. And you also try adding that overlay
to the list of overlays before you get the list of overlays you want
to add it to.

>         @Override
>     public void onCreate(Bundle savedInstanceState) {
>
>                 GeoPoint point = new GeoPoint(19240000,-99120000);
>                 OverlayItem overlayitem = new OverlayItem(point, "", "");
>                 itemizedOverlay.addOverlay(overlayitem);
>                 mapOverlays.add(itemizedOverlay);
>                 mapOverlays = mapView.getOverlays();
>                 drawable = this.getResources().getDrawable
> (R.drawable.androidmarker);
>                 itemizedOverlay = new NewItemizedOverlay(drawable);
>
>                 super.onCreate(savedInstanceState);
>         setContentView(R.layout.map);
>                 linearLayout = (LinearLayout) findViewById(R.id.zoomview);
>         mapView = (MapView) findViewById(R.id.mapview);
>         mapView.setBuiltInZoomControls(true);
>         mapView.setSatellite(true);
>     }

This is all out of order. You need to initialize your variables before
you try to use them.
Try this in your onCreate():

super.onCreate(savedInstanceState);
setContentView(R.layout.map);
mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
mapView.setSatellite(true);

mapOverlays = mapView.getOverlays();

drawable = this.getResources().getDrawable(R.drawable.androidmarker);
itemizedOverlay = new NewItemizedOverlay(drawable);

GeoPoint point = new GeoPoint(19240000,-99120000);
OverlayItem overlayitem = new OverlayItem(point, "", "");
itemizedOverlay.addOverlay(overlayitem);



Hope that helps!
Jed



--~--~---------~--~----~------------~-------~--~----~
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to