Android Map : How to cutomize Marker icon with SVG file?-ThrowExceptions

Exception or error:

I have a SGV icon (.svg) that I want to use like cutom icon for map markers.

How should I proceed ? I didn’t find anything on the subject.

How to solve:

If the SVG is part of your resources, you could simply add it to MarkerOptions by calling

val svgIcon = BitmapDescriptorFactory.fromResource(R.drawable.your_svg_name_here)
val marker = MarkerOptions().position(LatLng(latitude, longitude)).icon(svgIcon)

If it isn’t in your resources, just use another method of the BitmapDescriptorFactory.

Leave a Reply

Your email address will not be published. Required fields are marked *