interfacexamaringoogle-maps-android-api-2android-adapterimplements

How do I implement an InfoWindowAdapter interface in Xamarin?


I am using Xamarin and I am wanting to create a CustomWindowAdapter that implements a GoogleMap.InfoWindowAdapter interface.

I have tried this so far:

public class CustomWindowAdapter : InfoWindowAdapter
{

}

I am getting this error:

Error CS0246: The type or namespace name 'InfoWindowAdapter' could not be found (are you missing a using directive or an assembly reference?)

Here is the documentation for the interface: https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/GoogleMap.InfoWindowAdapter

Can I please have some help?

What using statement do I need to use?

Thanks in advance


Solution

  • Step 1: Get Google Play Services component from Component Store

    Step 2: Implement GoogleMap.IInfoWindowAdapter

    using Android.Gms.Maps;
    using Android.Gms.Maps.Model;
    using Android.Views;
    
    public class InfoWindow : Java.Lang.Object, GoogleMap.IInfoWindowAdapter
    {
        #region IInfoWindowAdapter implementation
    
        public View GetInfoContents(Marker p0)
        {
            throw new NotImplementedException ();
        }
    
        public View GetInfoWindow(Marker p0)
        {
            throw new NotImplementedException ();
        }
    
        #endregion
    }