I dropped a pin on Google map, if I click that pin means, it shows the place information. This is working fine. But , My requirement is , when clicked that pin , i want to go some particular page, which is included in my code.
For ex: If i click this pin, i want to go the information details page in the application. How can I add the click event for the Google map point.
Here is my sample snippet..
private MapView mapView;
mapView = (MapView) findViewById(R.id.map_view);
mapView.setBuiltInZoomControls(true);
mapView.setTraffic(true);
List<Overlay> mapOverlays = mapView.getOverlays();
Drawable drawable = this.getResources().getDrawable(R.drawable.pushpin);
CustomItemizedOverlay itemizedOverlay = new CustomItemizedOverlay(drawable, this);
GeoPoint point = new GeoPoint((int)(12.826782 * 1e6),(int)(80.220298 * 1e6));
OverlayItem overlayitem = new OverlayItem(point, "Hello", "Helloo World!");
itemizedOverlay.addOverlay(overlayitem);
mapOverlays.add(itemizedOverlay);
MapController mapController = mapView.getController();
mapController.animateTo(point);
mapController.setZoom(3);
In your CustomItemizedOverlay, you need to overide ItemizedOverlay.onTap(int).
You’ll have something like that :
When this action occurs, if you want to create an activity, you’ll need to have the Context or to notify a listener. From my point of view, the second solution is better :
And in your activity :