Circle | Android Developers

Quicknav Quicknav
Links

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

Android Sites

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

Language
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: Methods | Inherited Methods | [Expand All]
public final class

# Circle

extends Object

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

## Class Overview

A circle on the earth's surface (spherical cap).

A circle has the following properties.

Center
  The center is specified as a `LatLng`.
Radius
  The radius is specified in meters. It should be zero or greater.
Stroke Width
  The width of the circle outline in screen pixels. The width is constant and independent of the camera's zoom level.
Stroke Color
  The color of the circle outline in ARGB format, the same format used by `Color`.
Fill Color
  The color of the circle fill in ARGB format, the same format used by `Color`.
Z-Index
  The order in which this circle is drawn with respect to other overlays. An overlay with a larger z-index is drawn over overlays with smaller z-indices. The order of overlays with the same z-index value is arbitrary.
Visibility
  Indicates if the circle is visible or invisible, i.e., whether it is drawn on the map. An invisible polygon is not drawn, but retains all of its other properties. The default is `true`, i.e., visible.

Methods that modify a Polygon must be called on the main thread. If not, an `IllegalStateException` will be thrown at runtime.

### Example

     GoogleMap map;
     // ... get a map.
     // Add a circle in Sydney
     Circle circle = map.addCircle(new CircleOptions()
         .center(new LatLng(-33.87365, 151.20689)
         .radius(10000)
         .strokeColor(Color.RED)
         .fillColor(Color.BLUE));

Note that the current map renderer is unable to draw the circle fill if the circle encompasses either North and/or South pole. However the outline will still be drawn correctly.

## Summary

Public Methods
boolean | equals(Object other)
LatLng | getCenter() Gets the center as a `LatLng`.
int | getFillColor() Gets the fill color.
String | getId() Gets the id.
double | getRadius() Gets the radius in meters.
int | getStrokeColor() Gets the stroke color.
float | getStrokeWidth() Gets the stroke width.
float | getZIndex() Gets the zIndex.
int | hashCode()
boolean | isVisible() Gets the visibility of this circle.
void | remove() Removes from the map.
void | setCenter(LatLng center) Sets the center using a `LatLng`.
void | setFillColor(int color) Sets the fill color.
void | setRadius(double radius) Sets the radius in meters.
void | setStrokeColor(int color) Sets the stroke color.
void | setStrokeWidth(float width) Sets the stroke width.
void | setVisible(boolean visible) Sets the visibility.
void | setZIndex(float zIndex) Sets the zIndex.

[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)

## Public Methods

#### public boolean equals (Object other)

#### public LatLng getCenter ()

Gets the center as a `LatLng`.

##### Returns

- geographic center as a `LatLng`

#### public int getFillColor ()

Gets the fill color.

##### Returns

- color in the `Color` format

#### public String getId ()

Gets the id.

#### public double getRadius ()

Gets the radius in meters.

##### Returns

- radius in meters

#### public int getStrokeColor ()

Gets the stroke color.

##### Returns

- color in the `Color` format

#### public float getStrokeWidth ()

Gets the stroke width.

##### Returns

- width in screen pixels

#### public float getZIndex ()

Gets the zIndex.

##### Returns

- zIndex value

#### public int hashCode ()

#### public boolean isVisible ()

Gets the visibility of this circle.

##### Returns

- false if the circle is invisible

#### public void remove ()

Removes from the map.

#### public void setCenter (LatLng center)

Sets the center using a `LatLng`.

The center must not be null.

##### Parameters

center | geographic center as a `LatLng`

##### Throws

NullPointerException | if center is null

#### public void setFillColor (int color)

Sets the fill color.

The fill color is the color inside the circle, in the integer format specified by `Color`. If `TRANSPARENT` is used then no fill is drawn.

##### Parameters

color | color in the `Color` format

#### public void setRadius (double radius)

Sets the radius in meters.

The radius must be zero or greater.

##### Parameters

radius | radius in meters

##### Throws

IllegalArgumentException | if radius is negative

#### public void setStrokeColor (int color)

Sets the stroke color.

The stroke color is the color of this circle's outline, in the integer format specified by `Color`. If `TRANSPARENT` is used then no outline is drawn.

##### Parameters

color | color in the `Color` format

#### public void setStrokeWidth (float width)

Sets the stroke width.

The stroke width is the width (in screen pixels) of the circle's outline. It must be zero or greater. If it is zero then no outline is drawn.

##### Parameters

width | width in screen pixels

##### Throws

IllegalArgumentException | if width is negative

#### public void setVisible (boolean visible)

Sets the visibility.

If this circle is not visible then it is not drawn, but all other state is preserved.

##### Parameters

visible | false to make this circle invisible

#### public void setZIndex (float zIndex)

Sets the zIndex.

Overlays (such as circles) with higher zIndices are drawn above those with lower indices.

##### Parameters

zIndex | zIndex value