One of the solution is to call super method in onTap(GeoPoint p, MapView mapView). If super method have handled the event, return with true; otherwise perform as normal.
@Override
public boolean onTap(GeoPoint p, MapView mapView) {
// TODO Auto-generated method stub
if(super.onTap(p, mapView)){
return true;
}
String title = "pt:" + String.valueOf(overlayItemList.size() + 1);
String snippet = "geo:\n"
+ String.valueOf(p.getLatitudeE6()) + "\n"
+ String.valueOf(p.getLongitudeE6());
addItem(p, title, snippet);
return true;
}
@Override
protected boolean onTap(int index) {
// TODO Auto-generated method stub
//return super.onTap(index);
Toast.makeText(context,
"Touch on marker: \n" + overlayItemList.get(index).getTitle(),
Toast.LENGTH_LONG).show();
return true;
}
Next:
- Switch Activity once a marker on a MapView tapped
0 Response to "Handle both onTap(GeoPoint p, MapView mapView) and onTap(int index) implemented in MapView"
Posting Komentar