user3412690 user3412690 - 1 month ago 5x
Android Question

Google maps api v2, on marker click to open a fragment on the map

What I want to realise:

I want my markers, that are clickable, to open a fragment on top of the map when I'm in their proximity.
This fragment will list some text and pictures.
I want this fragment to overlay only a part of the googlemap and to be closeable.

I already have some basic info in the 'snippet'-thingy that opens one click.
I also have a function that calculates the distance from the middle of the screen to a location and puts it in the snippet.

some code I have:


googlemap.addMarker(new MarkerOptions()
.position(new LatLng(een.getLatitude(),een.getLongitude()))

Thanks in advance!
if I didn't explain myself good enough please ask for more


implement OnMarkerClickListener

and use this method: (it will be called when u click on a marker)

    public boolean onMarkerClick(Marker marker) {
        return false;

inside this function open your fragment.