Android map marker color?

This is how to make a default marker

Marker melbourne = mMap.addMarker(new MarkerOptions().position(MELBOURNE)
    .icon(BitmapDescriptorFactory
        .defaultMarker(BitmapDescriptorFactory.HUE_AZURE)));

and these are the constants you can use

float   HUE_AZURE   
float   HUE_BLUE    
float   HUE_CYAN    
float   HUE_GREEN   
float   HUE_MAGENTA 
float   HUE_ORANGE  
float   HUE_RED 
float   HUE_ROSE    
float   HUE_VIOLET  
float   HUE_YELLOW

Here is a method I am using to generate dynamic Hue colors for markers based on given String color.

May be useful for someone :)

Marker melbourne = mMap.addMarker(new MarkerOptions().position(MELBOURNE)
.icon(getMarkerIcon("#ff2299")));

// method definition
public BitmapDescriptor getMarkerIcon(String color) {
    float[] hsv = new float[3];
    Color.colorToHSV(Color.parseColor(color), hsv);
    return BitmapDescriptorFactory.defaultMarker(hsv[0]);
}

DETAILED ANSWER!

float hue = 120;  //(Range: 0 to 360)

Marker melbourne = mMap.addMarker(new MarkerOptions().position(MELBOURNE)
    .icon(BitmapDescriptorFactory
        .defaultMarker(hue)));

You can give any hue value ranging from 0 to 360, some constants are defined here (https://developers.google.com/android/reference/com/google/android/gms/maps/model/BitmapDescriptorFactory)

BEST WAY! to find required hue(that matches your required color).

Open this image defult_pin in Paint.Net/Photoshop editor (or other)

Goto hue options in your photo editor and slide hue bar and note best matched hue value.

  • For Paint.net (Adjustments -> Hue/Saturation)

  • For Photoshop (Photography -> Adjustments -> Hue/Saturation)

if value is above 0, use exact value , if value is below 0, take postivie (absolute) of value, add it in 180 and use the result value.

enter image description here