Quicknav Quicknav
Links

- Google Play Developer Console
- Android Developers Blog
- About Android

Android Sites

- Android.com
- Android Developers
- Android Open Source Project

close

- - Get Started
  - Style
  - Patterns
  - Building Blocks
  - Downloads
  - Videos
- - Training
  - API Guides
  - Reference
  - Tools
    - Get the SDK
  - Google Services
- - Google Play
  - Publishing
  - Promoting
  - App Quality
  - Spotlight
  - Open Distribution

## Results

Loading...
Summary: Constants | Methods | Inherited Methods | [Expand All]
public final class

# BitmapDescriptorFactory

extends Object

java.lang.Object
↳ | com.google.android.gms.maps.model.BitmapDescriptorFactory

## Class Overview

Used to create a definition of an 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:

- Wait for a `GoogleMap` to become available from a `MapFragment` or `MapView` that you have added to your application. You can verify that the `GoogleMap` is available by calling the `getMap()` method and checking that the returned object is not null.
- Call `MapsInitializer.initialize(Context)`. As long as a `GooglePlayServicesNotAvailableException` isn't thrown, this class will be correctly initialized.

## Summary

Constants
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 Methods
static BitmapDescriptor | defaultMarker() Creates a bitmap descriptor that refers to the default marker image.
static BitmapDescriptor | defaultMarker(float hue) Creates a bitmap descriptor that refers to a colorization of the default marker image.
static BitmapDescriptor | fromAsset(String assetName) Creates a `BitmapDescriptor` using the name of an image in the assets directory.
static BitmapDescriptor | fromBitmap(Bitmap image) Creates a bitmap descriptor from a given image.
static BitmapDescriptor | fromFile(String fileName) Creates a `BitmapDescriptor` using the name of an image file located in the internal storage.
static BitmapDescriptor | fromPath(String absolutePath) Creates a bitmap descriptor from an absolute file path.
static BitmapDescriptor | fromResource(int resourceId) Creates a `BitmapDescriptor` using the resource id of an image.

[Expand] Inherited Methods

From class java.lang.Object

Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)

## 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 ()

Creates a bitmap descriptor that refers to the default marker image.

#### public static BitmapDescriptor defaultMarker (float hue)

Creates a bitmap descriptor 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 fromAsset (String assetName)

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

##### Parameters

assetName | The name of an image in the assets directory.

##### Returns

- the `BitmapDescriptor` that was loaded from the asset or `null` if failed to load.

#### public static BitmapDescriptor fromBitmap (Bitmap image)

Creates a bitmap descriptor from a given image.

#### public static BitmapDescriptor fromFile (String fileName)

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

##### Parameters

fileName | The name of the image file.

##### Returns

- the `BitmapDescriptor` that was loaded from the asset or `null` if failed to load.

##### See Also

- Using the Internal Storage

#### public static BitmapDescriptor fromPath (String absolutePath)

Creates a bitmap descriptor from an absolute file path.

##### Parameters

absolutePath | The absolute path of the image.

##### Returns

- the `BitmapDescriptor` that was loaded from the absolute path or `null` if failed to load.

#### public static BitmapDescriptor fromResource (int resourceId)

Creates a `BitmapDescriptor` using the resource id of an image.

##### Parameters

resourceId | The resource id of an image.

##### Returns

- the `BitmapDescriptor` that was loaded from the asset or `null` if failed to load.