BitmapDescriptorFactory

public final class BitmapDescriptorFactory extends Object

Used to create a definition of a Bitmap image, used for marker icons and ground overlays.

Prior to using any methods from this class, you must do one of the following to ensure that this class is initialized:

Constant Summary

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

Public Method Summary

static BitmapDescriptor
defaultMarker(float hue)
Creates a BitmapDescriptor that refers to a colorization of the default marker image.
static BitmapDescriptor
defaultMarker()
Creates a BitmapDescriptor that refers to the default marker image.
static BitmapDescriptor
fromAsset(String assetName)
Creates a BitmapDescriptor using the name of a Bitmap image in the assets directory.
static BitmapDescriptor
fromBitmap(Bitmap image)
Creates a BitmapDescriptor from a given Bitmap image.
static BitmapDescriptor
fromFile(String fileName)
Creates a BitmapDescriptor using the name of a Bitmap image file located in the internal storage.
static BitmapDescriptor
fromPath(String absolutePath)
Creates a BitmapDescriptor from the absolute file path of a Bitmap image.
static BitmapDescriptor
fromPinConfig(PinConfig pinConfig)
Creates a BitmapDescriptor from a given PinConfig.
static BitmapDescriptor
fromResource(int resourceId)
Creates a BitmapDescriptor using the resource ID of a Bitmap image.

Inherited Method Summary

Constants

public static final float HUE_AZURE

Constant Value: 210.0

public static final float HUE_BLUE

Constant Value: 240.0

public static final float HUE_CYAN

Constant Value: 180.0

public static final float HUE_GREEN

Constant Value: 120.0

public static final float HUE_MAGENTA

Constant Value: 300.0

public static final float HUE_ORANGE

Constant Value: 30.0

public static final float HUE_RED

Constant Value: 0.0

public static final float HUE_ROSE

Constant Value: 330.0

public static final float HUE_VIOLET

Constant Value: 270.0

public static final float HUE_YELLOW

Constant Value: 60.0

Public Methods

public static BitmapDescriptor defaultMarker (float hue)

Creates a BitmapDescriptor that refers to a colorization of the default marker image. For convenience, there is a predefined set of hue values. See example HUE_YELLOW.

Parameters
hue The hue of the marker. Value must be greater or equal to 0 and less than 360.

public static BitmapDescriptor defaultMarker ()

Creates a BitmapDescriptor that refers to the default marker image.

public static BitmapDescriptor fromAsset (String assetName)

Creates a BitmapDescriptor using the name of a Bitmap image in the assets directory.

Parameters
assetName The name of a Bitmap image in the assets directory.
Returns

public static BitmapDescriptor fromBitmap (Bitmap image)

Creates a BitmapDescriptor from a given Bitmap image.

Parameters
image

public static BitmapDescriptor fromFile (String fileName)

Creates a BitmapDescriptor using the name of a Bitmap image file located in the internal storage. In particular, this calls Context.openFileInput(String).

Parameters
fileName The name of the Bitmap image file.
Returns

public static BitmapDescriptor fromPath (String absolutePath)

Creates a BitmapDescriptor from the absolute file path of a Bitmap image.

Parameters
absolutePath The absolute path of the Bitmap image.
Returns
  • the BitmapDescriptor that was loaded from the absolute path or null if failed to load.

public static BitmapDescriptor fromPinConfig (PinConfig pinConfig)

Creates a BitmapDescriptor from a given PinConfig.

This API does not apply to the Navigation SDK. It exists for compile time compatibility with com.google.android.gms:play-services-maps only.

Parameters
pinConfig instance to create a bitmap for
Returns

public static BitmapDescriptor fromResource (int resourceId)

Creates a BitmapDescriptor using the resource ID of a Bitmap image.

Parameters
resourceId The resource ID of a Bitmap image.
Returns