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

- - About
  - Wear
  - TV
  - Auto
- - Get Started
  - Devices
  - Style
  - Patterns
  - Building Blocks
  - Downloads
  - Videos
- - Training
  - API Guides
  - Reference
  - Tools
  - Google Services
  - Samples
- - Google Play
  - Essentials
  - Get Users
  - Engage & Retain
  - Monetize
  - Tools & Reference
  - Developer Stories

## 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 of the Circle is specified as a `LatLng`.
Radius
  The radius of the circle, specified in meters. It should be zero or greater.
Stroke Width
  The width of the circle's outline in screen pixels. The width is constant and independent of the camera's zoom level. The default value is 10.
Stroke Color
  The color of the circle outline in ARGB format, the same format used by `Color`. The default value is black (`0xff000000`).
Fill Color
  The color of the circle fill in ARGB format, the same format used by `Color`. The default value is transparent (`0x00000000`).
Z-Index
  The order in which this tile overlay is drawn with respect to other overlays (including `GroundOverlay`s, `TileOverlay`s, `Polyline`s, and `Polygon`s but not `Marker`s). An overlay with a larger z-index is drawn over overlays with smaller z-indices. The order of overlays with the same z-index is arbitrary. The default zIndex is 0.
Visibility
  Indicates if the circle is visible or invisible, i.e., whether it is drawn on the map. An invisible circle is not drawn, but retains all of its other properties. The default is `true`, i.e., visible.

Methods that modify a Circle 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 the North or South pole. However, the outline will still be drawn correctly.

### Developer Guide

For more information, read the Shapes developer guide.

## Summary

Public Methods
LatLng | getCenter() Returns the center as a `LatLng`.
int | getFillColor() Returns the fill color of this Circle.
String | getId() Gets this circle's id.
double | getRadius() Returns the circle's radius, in meters.
int | getStrokeColor() Returns the stroke color.
float | getStrokeWidth() Returns the stroke width.
float | getZIndex() Returns the zIndex.
boolean | isVisible() Checks whether the circle is visible.
void | remove() Removes this circle 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 of the circle.
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 LatLng getCenter ()

Returns the center as a `LatLng`.

##### Returns

- The geographic center as a `LatLng`.

#### public int getFillColor ()

Returns the fill color of this Circle.

##### Returns

- The fill color of the circle in ARGB format.

#### public String getId ()

Gets this circle's id. The id will be unique amongst all Circles on a map.

#### public double getRadius ()

Returns the circle's radius, in meters.

##### Returns

- The radius in meters.

#### public int getStrokeColor ()

Returns the stroke color.

##### Returns

- The color of the circle in ARGB format.

#### public float getStrokeWidth ()

Returns the stroke width.

##### Returns

- The width in screen pixels.

#### public float getZIndex ()

Returns the zIndex.

##### Returns

- The zIndex of this circle.

#### public boolean isVisible ()

Checks whether the circle is visible.

##### Returns

- True if the circle is visible; false if it is invisible.

#### public void remove ()

Removes this circle from the map.

#### public void setCenter (LatLng center)

Sets the center using a `LatLng`.

The center must not be null, as there is no default value.

##### Parameters

center | The geographic center of the circle, specified 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 | The color in the `Color` format.

#### public void setRadius (double radius)

Sets the radius in meters.

The radius must be zero or greater.

##### Parameters

radius | The 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 | The stroke 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. The default value is 10.

##### Parameters

width | The stroke width, in screen pixels.

##### Throws

IllegalArgumentException | if width is negative

#### public void setVisible (boolean visible)

Sets the visibility of the circle.

If this circle is not visible then it will not be drawn. All other state is preserved. Defaults to True.

##### 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 | The zIndex value.