Skip to content

Instantly share code, notes, and snippets.

@mizutori
Created January 6, 2019 08:59
Show Gist options
  • Save mizutori/b4e9bcfe51c5db5ee031284ef4dc4b4a to your computer and use it in GitHub Desktop.
Save mizutori/b4e9bcfe51c5db5ee031284ef4dc4b4a to your computer and use it in GitHub Desktop.
private fun drawUserPositionMarker(location: Location) {
val latLng = LatLng(location.latitude, location.longitude)
if (this.userPositionMarkerBitmapDescriptor == null) {
userPositionMarkerBitmapDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.user_position_point)
}
userPositionMarker?.let{
it.setPosition(latLng)
} ?: run{
userPositionMarker = map.addMarker(
MarkerOptions()
.position(latLng)
.flat(true)
.anchor(0.5f, 0.5f)
.icon(this.userPositionMarkerBitmapDescriptor)
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment