0

In my code i need to put this lines to start the onMapReady to do a addMarker so in my activity i got this: class Activity : AppCompatActivity(), OnMapReadyCallback {}.

Then i got this to do an addMarker:

    override fun onMapReady(indiaMap: MapboxMap) {
        mMap = indiaMap
        markerOptions = com.mapbox.mapboxsdk.annotations.MarkerOptions().position(com.mapbox.mapboxsdk.geometry.LatLng(41.390205,2.154007)).icon(
            IconFactory.getInstance(this).fromResource(R.drawable.ic_moto))
        mMap.addMarker(markerOptions)
}

So in this website i'm using https://www.mapmyindia.com/api/advanced-maps/android/vector-maps-sdk#Show-Zoom-Control-button i see that to use the markers or other thinks for the map i need to put this on onCreate() {}:

val mapFragment = supportFragmentManager
            .findFragmentById(R.id.map_view) as SupportMapFragment?
        mapFragment!!.getMapAsync(this)

The problem is that in the part of getMapAsync(this) i got a problem that put:

Type mismatch.
Required:
OnMapReadyCallback
Found:
Activity

The question is why in getMapAsync can't listen the onMapReadyCallback from the Activity?

Norwind
  • 23
  • 3

0 Answers0