I am working on an app that makes use of the OSMbonuspacket. I added markers with descriptions to the map. When clicking one of the markers, the description box is shown.
Now I want to call another function when tapping on a marker. Let's say I want to show a Toast. So I added the following setOnMarkerClickListener()
function:
marker.setOnMarkerClickListener(new Marker.OnMarkerClickListener() {
@Override
public boolean onMarkerClick(Marker marker, MapView mapView) {
Toast.makeText(context, "Hallo", Toast.LENGTH_LONG).show();
return false;
}
});
This shows the Toast when clicking the marker. However, the description box is not displayed anymore. I guess that I am overriding the default behavior. with this function. I made an app with a Google Maps integration once and did the same thing without any problems.
Does anyone know how to accomplish this with the OSMbonuspacket?
Default click listener for Marker in osmdroid look like this:
so, you can override your listener like this: