Reputation: 8977
I have the following class which extends Overlay that draws the pin in my Google Map, the question is how do I add a click listener on that so when I click on the pin I can redirect it to a different activity?
class MapOverlay extends Overlay
{
private GeoPoint p;
public MapOverlay(GeoPoint p){
this.p = p;
}
public boolean draw(Canvas canvas, MapView mapView,
boolean shadow, long when)
{
super.draw(canvas, mapView, shadow);
//---translate the GeoPoint to screen pixels---
Point screenPts = new Point();
mapView.getProjection().toPixels(p, screenPts);
//---add the marker---
Bitmap bmp = BitmapFactory.decodeResource(
getResources(), R.drawable.pushpin);
canvas.drawBitmap(bmp, screenPts.x, screenPts.y-50, null);
return true;
}
}
Upvotes: 0
Views: 549