When trying to change the marker icon is overlapped with the old icon. the old icon is still there
for (i in chargingPointOnMapData.indices) {
position = LatLng(
chargePointsOnMap[i].lattitude!!.toDouble(),
chargePointsOnMap[i].longitude!!.toDouble()
)
this.googleMap?.addMarker(MarkerOptions()
.position(position)
.title(markerType)
.zIndex(zIndex)
.icon(BitmapDescriptorFactory.fromResource(markerIcon))
)}
override fun onMapReady(googleMap: GoogleMap) {
googleMap.setOnMarkerClickListener{
marker.apply {
setIcon(BitmapDescriptorFactory.fromResource(R.drawable.test_cp_ac))
}
}
}
