CameraPosition.Builder
Stay organized with collections
Save and categorize content based on your preferences.
Public Constructor Summary
|
Builder()
Creates an empty builder.
|
|
|
Inherited Method Summary
From class
java.lang.Object
boolean
|
equals(Object arg0)
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
Public Constructors
public
Builder
()
Creates an empty builder.
Public Methods
Sets the direction that the camera is pointing in, in degrees clockwise from north.
Sets the location that the camera is pointing at.
Sets the angle, in degrees, of the camera from the nadir (directly facing the Earth). When
changing the camera position for a map, this value is restricted depending on the zoom level
of the camera. The restrictions are as follows:
- For zoom levels less than 10 the maximum is 30.
- For zoom levels from 10 to 14 the maximum increases linearly from 30 to 45 (e.g. at
zoom level 12, the maximum is 37.5).
- For zoom levels from 14 to 15.5 the maximum increases linearly from 45 to 67.5.
- For zoom levels greater than 15.5 the maximum is 67.5.
The minimum is always 0 (directly down). If you specify a value outside this range and try to
move the camera to this camera position it will be clamped to these bounds.
Sets the zoom level of the camera. Zoom level is defined such that at zoom level 0, the whole
world is approximately 256dp wide (assuming that the camera is not tilted). Increasing the
zoom level by 1 doubles the width of the world on the screen. Hence at zoom level N, the
width of the world is approximately 256 * 2 N dp, i.e., at zoom level 2, the whole
world is approximately 1024dp wide.
When changing the camera position for a map, the zoom level of the camera is restricted to
a certain range depending on various factors including location, map type and map size. Use
GoogleMap.getMinZoomLevel
and
GoogleMap.getMaxZoomLevel
to
find the restrictions. Note that the camera zoom need not be an integer value.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-28 UTC.
[null,null,["Last updated 2025-08-28 UTC."],[[["\u003cp\u003e\u003ccode\u003eCameraPosition.Builder\u003c/code\u003e is used to create a \u003ccode\u003eCameraPosition\u003c/code\u003e object, defining the camera's view on a map.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to set the camera's target location, zoom level, bearing (direction), and tilt angle.\u003c/p\u003e\n"],["\u003cp\u003eTwo constructors are available: one to create an empty builder and another to initialize it with an existing \u003ccode\u003eCameraPosition\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003ebuild()\u003c/code\u003e method is used to finally create the immutable \u003ccode\u003eCameraPosition\u003c/code\u003e instance based on the builder's settings.\u003c/p\u003e\n"],["\u003cp\u003eThe camera's tilt and zoom levels have restrictions depending on various factors to ensure a valid and usable map view.\u003c/p\u003e\n"]]],[],null,["public static final class **CameraPosition.Builder** extends Object \nBuilds camera position. \n\nPublic Constructor Summary\n\n|---|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | [Builder](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/model/CameraPosition.Builder#Builder())() Creates an empty builder. |\n| | [Builder](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/model/CameraPosition.Builder#Builder(com.google.android.gms.maps.model.CameraPosition))([CameraPosition](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/model/CameraPosition) previous) |\n\nPublic Method Summary\n\n|-----------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [CameraPosition.Builder](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/model/CameraPosition.Builder) | [bearing](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/model/CameraPosition.Builder#bearing(float))(float bearing) Sets the direction that the camera is pointing in, in degrees clockwise from north. |\n| [CameraPosition](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/model/CameraPosition) | [build](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/model/CameraPosition.Builder#build())() Builds a [CameraPosition](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/model/CameraPosition). |\n| [CameraPosition.Builder](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/model/CameraPosition.Builder) | [target](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/model/CameraPosition.Builder#target(com.google.android.gms.maps.model.LatLng))([LatLng](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/model/LatLng) location) Sets the location that the camera is pointing at. |\n| [CameraPosition.Builder](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/model/CameraPosition.Builder) | [tilt](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/model/CameraPosition.Builder#tilt(float))(float tilt) Sets the angle, in degrees, of the camera from the nadir (directly facing the Earth). |\n| [CameraPosition.Builder](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/model/CameraPosition.Builder) | [zoom](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/model/CameraPosition.Builder#zoom(float))(float zoom) Sets the zoom level of the camera. |\n\nInherited Method Summary \nFrom class java.lang.Object \n\n|------------------|---------------------------|\n| boolean | equals(Object arg0) |\n| final Class\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| String | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Constructors \n\npublic\n**Builder**\n() \nCreates an empty builder. \n\npublic\n**Builder**\n([CameraPosition](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/model/CameraPosition) previous) \n\u003cbr /\u003e\n\nParameters\n\n| previous | |\n|----------|---|\n\nPublic Methods \n\npublic [CameraPosition.Builder](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/model/CameraPosition.Builder)\n**bearing**\n(float bearing) \nSets the direction that the camera is pointing in, in degrees clockwise from north. \n\nParameters\n\n| bearing | |\n|---------|---|\n\npublic [CameraPosition](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/model/CameraPosition)\n**build**\n() \nBuilds a [CameraPosition](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/model/CameraPosition). \n\npublic [CameraPosition.Builder](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/model/CameraPosition.Builder)\n**target**\n([LatLng](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/model/LatLng) location) \nSets the location that the camera is pointing at. \n\nParameters\n\n| location | |\n|----------|---|\n\npublic [CameraPosition.Builder](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/model/CameraPosition.Builder)\n**tilt**\n(float tilt) \nSets the angle, in degrees, of the camera from the nadir (directly facing the Earth). When\nchanging the camera position for a map, this value is restricted depending on the zoom level\nof the camera. The restrictions are as follows:\n\n- For zoom levels less than 10 the maximum is 30.\n- For zoom levels from 10 to 14 the maximum increases linearly from 30 to 45 (e.g. at zoom level 12, the maximum is 37.5).\n- For zoom levels from 14 to 15.5 the maximum increases linearly from 45 to 67.5.\n- For zoom levels greater than 15.5 the maximum is 67.5.\n\nThe minimum is always 0 (directly down). If you specify a value outside this range and try to move the camera to this camera position it will be clamped to these bounds.\n\n\u003cbr /\u003e\n\nParameters\n\n| tilt | |\n|------|---|\n\npublic [CameraPosition.Builder](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/model/CameraPosition.Builder)\n**zoom**\n(float zoom) \nSets the zoom level of the camera. Zoom level is defined such that at zoom level 0, the whole\nworld is approximately 256dp wide (assuming that the camera is not tilted). Increasing the\nzoom level by 1 doubles the width of the world on the screen. Hence at zoom level N, the\nwidth of the world is approximately 256 \\* 2 ^N^ dp, i.e., at zoom level 2, the whole\nworld is approximately 1024dp wide.\n\nWhen changing the camera position for a map, the zoom level of the camera is restricted to\na certain range depending on various factors including location, map type and map size. Use\n[GoogleMap.getMinZoomLevel](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/GoogleMap#getMinZoomLevel()) and\n[GoogleMap.getMaxZoomLevel](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/GoogleMap#getMaxZoomLevel()) to\nfind the restrictions. Note that the camera zoom need not be an integer value. \n\nParameters\n\n| zoom | |\n|------|---|"]]