Hi
Take a look at this code
I would like to thank the other member of the group who help getting
this code to work
thank you
mapView = (MapView) findViewById(R.id.map);
Drawable defaultMarker = getResources().getDrawable(
R.drawable.mappin_red);
// You HAVE to specify the bounds! It seems like the markers
are drawn
// through Drawable.draw(Canvas) and therefore must have its
bounds set
// before drawing.
defaultMarker.setBounds(0, 0, defaultMarker.getIntrinsicWidth(),
defaultMarker.getIntrinsicHeight());
whereAmIOverlay = new WhereAmIOverlay(this,defaultMarker);
mapView.getController().animateTo(currentPoint);
mapView.getOverlays().add(whereAmIOverlay);
zoomView = mapView.getZoomControls();
zoomView.setLayoutParams(new ViewGroup.LayoutParams
(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
mapView.addView(zoomView);
mapView.displayZoomControls(true);
mapView.getController().setZoom(16);
mapView.setClickable(true);
mapView.setEnabled(true);
public class WhereAmIOverlay extends ItemizedOverlay< OverlayItem>{
private List<OverlayItem> mItemList = new ArrayList<OverlayItem>();
WhereAmI whereAmI;
GeoPoint geoPoint;
Drawable marker;
private Projection p;
Point point;
Paint paint;
public WhereAmIOverlay(WhereAmI whereAmI,Drawable defaultMarker) {
super(defaultMarker);
this.whereAmI = whereAmI;
paint = new Paint();
mItemList.add(new OverlayItem(whereAmI.currentPoint , "Title",
"Snippet"));
populate();
}
@Override
public void draw(Canvas canvas, MapView mapView, boolean shadow) {
// TODO Auto-generated method stub
super.draw(canvas, mapView, true);
p = mapView.getProjection();
point = p.toPixels(whereAmI.endCurrentPoint,null);
canvas.drawCircle(point.x, point.y, 10, paint);
}
@Override
protected OverlayItem createItem(int i) {
return mItemList.get(i);
}
@Override
public int size() {
return mItemList.size();
}
}
Peter
andrex wrote:
> Hi, I'm new here, I need some help. I'm building an aplicattion which
> show maps. My problem is that I need write information over the map. I
> was ussing canvas package but It did not work. Can you help me please.
>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---