Android Custom marker icon

Jamel Naghmouchi picture Jamel Naghmouchi · Apr 9, 2012 · Viewed 44.2k times · Source

I'm working on application with Google maps so i want to define a custom marker for each custom place, For example (gas station- Hotel- Hospital.. ) ! i have a overlays class with the latitude and longitude of many places and i want just how to give a custom icon!

Answer

Janusz picture Janusz · Dec 5, 2012

With the new Maps Api Setting the Icon for a Marker is done with the following Code:

MarkerOptions markerOptions = new MarkerOptions().icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_location));

The icon can not be changed after a Marker was created. To change an icon remove the marker and readd it with a new image.