Are you sure the overlay isn't just being drawn someplace else? Have you tried zooming out? I like to center my new overlay item with something like
mapView.getController().setCenter(p); The only thing I don't understand is the Location class (just never used it...). That's the only thing I saw you did different from my mapping activity. Ken On Feb 19, 10:55 am, "AndroidRef.com" <[email protected]> wrote: > Obviously the URL is "http://www.androidref.com". Sorry for the typo. > > Jay > > On Feb 19, 12:54 pm, "AndroidRef.com" <[email protected]> wrote: > > > > > Andrew, > > > Take a look at "Using the Google Maps API tomapa location and add a > > marker to themap." at "http://www.anroidref.com/". > > > From a quick glance, our code seem similar, though you're obviously > > drawing on themapand I'm dropping an image. If you still can't get > > it to work after reviewing my code snippets, I'll take a closer look. > > > Jay > > > On Feb 9, 10:44 am, andrew android <[email protected]> wrote: > > > > Bump) > > > > On Feb 6, 7:16 am, andrew android <[email protected]> wrote: > > > > > Can anyone help? Thanks! > > > > > On Feb 2, 7:42 pm,andrewandroid<[email protected]> wrote: > > > > > > <?xml version="1.0" encoding="utf-8"?> > > > > > <LinearLayout > > > > > xmlns:android="http://schemas.android.com/apk/res/android" > > > > > android:layout_width="wrap_content" > > > > > android:layout_height="wrap_content"> > > > > > > > > > > <com.google.android.maps.MapViewandroid:id="@+id/map_view"android:layout_wi > > > > > dth="fill_parent" > > > > > android:layout_height="fill_parent"android:enabled="true"android:clickable= > > > > > "true"android:apiKey="0lrZO7CweoTib-Xc4lzUlx2BLruXNt6rHvl0-TA" > > > > > /> > > > > > </LinearLayout> > > > > > > On Feb 2, 2:57 am, Kevin Duffey <[email protected]> wrote: > > > > > > > Oddly enough, I copied/pasted your code and I am getting a class > > > > > > not found > > > > > > issue.. for some reason I can't get the Launcher to start. Can you > > > > > > paste > > > > > > your layout xml and string resources as well? > > > > > > > On Mon, Feb 1, 2010 at 8:32 > > > > > > PM,andrewandroid<[email protected]>wrote: > > > > > > > > Any example of what I may be missing? Thanks! > > > > > > > > On Jan 31, 12:10 pm, Kevin Duffey <[email protected]> wrote: > > > > > > > > Hmm.. I don't know.. I did not set the overlay position.. I > > > > > > > > just added it > > > > > > > to > > > > > > > > my mapView and mine shows up. Try working with your location > > > > > > > > settings. I > > > > > > > am > > > > > > > > not sure why the Location is needed tho. I use an > > > > > > > > ItemizedOverlay for a > > > > > > > list > > > > > > > > of items I pull down from a server, which works fine. Mymapthen > > > > > > > responds > > > > > > > > to a click on an item, and puts another overlay above it with > > > > > > > > text. > > > > > > > > > On Sun, Jan 31, 2010 at 9:44 > > > > > > > > AM,andrewandroid<[email protected] > > > > > > > >wrote: > > > > > > > > > > Mymapoverlay is not showing up after several attempts > > > > > > > > > > Here is my Overlay class code: > > > > > > > > > > public class myOverlay extends Overlay{ > > > > > > > > > > private final int mRadius = 6; > > > > > > > > > �...@override > > > > > > > > > public void draw(Canvas canvas, MapView > > > > > > > > > mapView, boolean > > > > > > > > > shadow) { > > > > > > > > > super.draw(canvas, mapView, > > > > > > > > > shadow); > > > > > > > > > Projection projection = > > > > > > > > > mapView.getProjection(); > > > > > > > > > // if (shadow == false) { > > > > > > > > > Double latitude = > > > > > > > > > location.getLatitude()*1E6; > > > > > > > > > Double longitude = > > > > > > > > > location.getLongitude()*1E6; > > > > > > > > > GeoPoint geoPoint; > > > > > > > > > geoPoint = new > > > > > > > > > GeoPoint(latitude.intValue(),longitude.intValue > > > > > > > > > ()); > > > > > > > > > Point point = new Point(); > > > > > > > > > projection.toPixels(geoPoint, point); > > > > > > > > > RectF oval = new RectF(point.x - > > > > > > > > > mRadius, > > > > > > > point.y - > > > > > > > > > mRadius, > > > > > > > > > point.x + mRadius, point.y + mRadius); > > > > > > > > > // Setup the paint > > > > > > > > > Paint paint = new Paint(); > > > > > > > > > paint.setARGB(250, 255, 0, 0); > > > > > > > > > paint.setAntiAlias(true); > > > > > > > > > paint.setFakeBoldText(true); > > > > > > > > > Paint backPaint = new Paint(); > > > > > > > > > backPaint.setARGB(175, 50, 50, 50); > > > > > > > > > backPaint.setAntiAlias(true); > > > > > > > > > RectF backRect = new RectF(point.x + 2 > > > > > > > > > + > > > > > > > mRadius, > > > > > > > > > point.y - > > > > > > > > > 3*mRadius, point.x + 65, point.y + mRadius); > > > > > > > > > // Draw the marker > > > > > > > > > canvas.drawOval(oval, paint); > > > > > > > > > canvas.drawRoundRect(backRect, 5, 5, > > > > > > > > > backPaint); > > > > > > > > > canvas.drawText(noteName, point.x + > > > > > > > > > 2*mRadius, > > > > > > > > > point.y, paint); > > > > > > > > > > // } > > > > > > > > > // else { > > > > > > > > > > // } > > > > > > > > > > } > > > > > > > > > �...@override > > > > > > > > > public boolean onTap(GeoPoint point, MapView > > > > > > > > > mapView) { > > > > > > > > > // Return true if screen tap is handled by > > > > > > > > > this overlay > > > > > > > > > return false; > > > > > > > > > } > > > > > > > > > Location location; > > > > > > > > > > public Location getLocation() { > > > > > > > > > return location; > > > > > > > > > } > > > > > > > > > public void setLocation(Location location) { > > > > > > > > > this.location = location; > > > > > > > > > } > > > > > > > > > String noteName; > > > > > > > > > public String getNoteName(){ > > > > > > > > > return noteName; > > > > > > > > > } > > > > > > > > > public void setNoteName(String n){ > > > > > > > > > this.noteName = n; > > > > > > > > > } > > > > > > > > > } > > > > > > > > > > Here is the call to add the overlay: > > > > > > > > > > positionOverlay = new myOverlay(); > > > > > > > > > Location loc = new Location("over"); > > > > > > > > > loc.setLatitude(lat); > > > > > > > > > loc.setLongitude(lng); > > > > > > > > > positionOverlay.setLocation(loc); > > > > > > > > > positionOverlay.setNoteName(nm); > > > > > > > > > mapView.getOverlays().add(positionOverlay); > > > > > > > > > mapView.invalidate(); > > > > > > > > > > -- > > > > > > > > > You received this message because you are subscribed to the > > > > > > > > > Google > > > > > > > > > Groups "AndroidDevelopers" group. > > > > > > > > > To post to this group, send email to > > > > > > >[email protected] > > > > > > > > > To unsubscribe from this group, send email to > > > > > > > > >[email protected]<android-developers%2Bunsub > > > > > > > > > s [email protected]> > > > > > > > <android-developers%2bunsubs[email protected]> > > > > > > > > > For more options, visit this group at > > > > > > > > >http://groups.google.com/group/android-developers?hl=en-Hidequoted > > > > > > > text - > > > > > > > > > - Show quoted text - > > > > > > > > -- > > > > > > > You received this message because you are subscribed to the Google > > > > > > > Groups "AndroidDevelopers" group. > > > > > > > To post to this group, send email > > > > > > > [email protected] > > > > > > > To unsubscribe from this group, send email to > > > > > > >[email protected]<android-developers%2Bunsub > > > > > > > s [email protected]> > > > > > > > For more options, visit this group at > > > > > > >http://groups.google.com/group/android-developers?hl=en-Hidequotedtext- > > > > > > > - Show quoted text - -- 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

