You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In general, the library is pretty simple to use but there are few parts that might be confusing.
onCreateAnnotation should use the factory to create the marker and then onBindAnnotation should actually set up the marker attributes, the way is implemented feels you have to do it onCreatAnnotation since the factory requires position, bitmap and title but also during onBindAnnotation so feels like duplicating the job.
My suggestion would be that the factory only requires a position, so the MapAnnotation constructor. Then on the create Annotation you only make sure to create the marker on the position and during onBindAnnotation you set the attrs.
interfaceAnnotationFactory<inMap> {
funcreateMarker(latLng:LatLng): MarkerAnnotation...
}
abstractclassMarkerAnnotation(latLng:LatLng) : MapAnnotation() {
...
}
// MyAdapter...overridefunonBindAnnotation(annotation:MapAnnotation, position:Int, payload:Any?) {
// Set the attributes to the annotation
}
overridefunonCreateAnnotation(factory:AnnotationFactory, position:Int, annotationType:Int): MapAnnotation {
val item =this.markers[position]
return factory.createMarker(LatLng(item.latitude, item.longitude)
}
The text was updated successfully, but these errors were encountered:
Only accept the position of the marker so the onCreateAnnotation is
clearer and does not duplicate the work that should be done in
onBindAnnotation. That simplifies the adapter and avoid possible
duplication of work and resources.
Hi,
In general, the library is pretty simple to use but there are few parts that might be confusing.
onCreateAnnotation should use the factory to create the marker and then onBindAnnotation should actually set up the marker attributes, the way is implemented feels you have to do it onCreatAnnotation since the factory requires position, bitmap and title but also during onBindAnnotation so feels like duplicating the job.
My suggestion would be that the factory only requires a position, so the MapAnnotation constructor. Then on the create Annotation you only make sure to create the marker on the position and during onBindAnnotation you set the attrs.
The text was updated successfully, but these errors were encountered: