Question: Hi everyone I am using the GoogleMaps Gms.Maps class to show a map on my app (Xamarin.Android).

I am trying to make it so when you click on a marker it will take you to a specific page on my mobile app. however it seems the markers already have on click functions that centre it and display the title. I haven't created this and also can't find it (see below)
[![enter image description here](https://i.stack.imgur.com/4qX22.jpg)](https://i.stack.imgur.com/4qX22.jpg)

[![enter image description here](https://i.stack.imgur.com/XlNDa.jpg)](https://i.stack.imgur.com/XlNDa.jpg)

any idea how I would edit this function or create a new one?

thanks,

Answer: 
Implement `Android.Gms.Maps.GoogleMap.IOnMarkerClickListener` on your `Activity`, `Fragment` or in a separate class and assign that to the GoogleMap instance via the `SetOnMarkerClickListener` method.

### Example:

```
public class MyMarkerClickListener : Java.Lang.Object, IOnMarkerClickListener
{
    Context context;
    public MyMarkerClickListener(Context context)
    {
        this.context = context;
    }

    public bool OnMarkerClick(Marker marker)
    {
        Toast.MakeText(context, $"{marker.Title} was tapped", ToastLength.Long).Show();
        return true;
    }
}

```

### Usage:

```
googleMap.SetOnMarkerClickListener(new MyMarkerClickListener(this));

```

Note: Normally the listener would be assigned in the `OnMapReady` callback

Google Docs: [GoogleMap.OnMarkerClickListener](https://developers.google.com/android/reference/com/google/android/gms/maps/GoogleMap.OnMarkerClickListener)

> 
> Returns:
>  true if the listener has consumed the event (i.e., the default behavior should not occur); false otherwise (i.e., the default behavior should occur). The default behavior is for the camera to move to the marker and an info window to appear.
> 
> 
>
Well what @SushiHangover has answered is right but the easier way of doing it would be adding a marker click event: 

```
Googlemapsobj.MarkerClick+= (s,e)=>
{//yourcodeforNextPage };

```

Here you wont have to worry about the default behaviour as it will leave the page as soon as it is clicked.