imin
imin

Reputation: 4578

GoogleMap addMarker cannot have both setIcon and setTag?

private lateinit var mMap: GoogleMap
override fun onMapReady(googleMap: GoogleMap) {
        mMap = googleMap
        mMap.addMarker(options)
            .setIcon(vectorToBitmap(icon, Color.parseColor(color), this))
            .setTag(markerTag)
}

The code above won't work. But if I remove either setIcon or setTag, it won't display any error. But as above, it will display error Unresolved reference: setTag. If I remove the line setIcon, no error, setTag will work. If I put setTag above setIcon, it will display error Unresolved reference: setIcon

Did I jumbled up anything?

Upvotes: 0

Views: 41

Answers (1)

Sadegh.t
Sadegh.t

Reputation: 255

Try this:

       val markerMap =
                 mMap.addMarker(
                     MarkerOptions().position(location).title("Title")
                      .icon(vectorToBitmap(icon, Color.parseColor(color), this))
                    markerMap.tag = markerTag

Upvotes: 1

Related Questions