StreetViewPanorama | 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: Nested Classes | Methods | Inherited Methods | [Expand All]
public class

# StreetViewPanorama

extends Object

java.lang.Object
↳ | com.google.android.gms.maps.StreetViewPanorama

## Class Overview

This is the main class of the Street View feature in the Google Maps Android API and is the entry point for all methods related to Street View panoramas. You cannot instantiate a `StreetViewPanorama` object directly, rather, you must obtain one from the `getStreetViewPanorama()` method on a `MapFragment` or `MapView` that you have added to your application.

Note: Similar to a `View` object, a `StreetViewPanorama` can only be read and modified from the main thread. Calling `StreetViewPanorama` methods from another thread will result in an exception.

### Developer Guide

To get started with the Google Maps Android API, read the Google Maps Android API v2 developer guide.

## Summary

Nested Classes
interface | StreetViewPanorama.OnStreetViewPanoramaCameraChangeListener | A listener for when the StreetViewPanoramaCamera changes
interface | StreetViewPanorama.OnStreetViewPanoramaChangeListener | A listener for when the Street View panorama loads a new panorama
interface | StreetViewPanorama.OnStreetViewPanoramaClickListener | Callback interface for when the user taps on the panorama.

Public Methods
void | animateTo(StreetViewPanoramaCamera camera, long duration) Changes the current camera position, orientation and zoom, to a given position over a specified duration
StreetViewPanoramaLocation | getLocation() Returns the current location of the user and information regarding the current panorama's adjacent panoramas
StreetViewPanoramaCamera | getPanoramaCamera() Returns the current orientation and zoom
boolean | isPanningGesturesEnabled() Returns whether or not the panning gestures are enabled for the user
boolean | isStreetNamesEnabled() Returns whether or not the street names appear on the panorama
boolean | isUserNavigationEnabled() Returns whether or not the navigation is enabled for the user.
boolean | isZoomGesturesEnabled() Returns whether or not the zoom gestures are enabled for the user
Point | orientationToPoint(StreetViewPanoramaOrientation orientation) Returns a screen location that corresponds to an orientation (`StreetViewPanoramaOrientation`).
StreetViewPanoramaOrientation | pointToOrientation(Point point) Returns the orientation that corresponds to a screen location.
final void | setOnStreetViewPanoramaCameraChangeListener(StreetViewPanorama.OnStreetViewPanoramaCameraChangeListener listener) Sets a callback that's invoked when the camera changes
final void | setOnStreetViewPanoramaChangeListener(StreetViewPanorama.OnStreetViewPanoramaChangeListener listener) Sets a callback that's invoked when the panorama changes
final void | setOnStreetViewPanoramaClickListener(StreetViewPanorama.OnStreetViewPanoramaClickListener listener) Sets a callback that's invoked when the panorama is tapped.
void | setPanningGesturesEnabled(boolean enablePanning) Sets whether the user is able to use panning gestures
void | setPosition(LatLng position) Sets the StreetViewPanorama to a given location
void | setPosition(String panoId) Sets the StreetViewPanorama to a given location
void | setPosition(LatLng position, int radius) Sets the StreetViewPanorama to a given location
void | setStreetNamesEnabled(boolean enableStreetNames) Sets whether the user is able to see street names on panoramas
void | setUserNavigationEnabled(boolean enableUserNavigation) Sets whether the user is able to move to another panorama
void | setZoomGesturesEnabled(boolean enableZoom) Sets whether the user is able to use zoom gestures

[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 void animateTo (StreetViewPanoramaCamera camera, long duration)

Changes the current camera position, orientation and zoom, to a given position over a specified duration

##### Parameters

camera | The camera position to animate to
duration | The length of time, in milliseconds, it takes to transition from the current camera position to the given one

#### public StreetViewPanoramaLocation getLocation ()

Returns the current location of the user and information regarding the current panorama's adjacent panoramas

##### Returns

- The current location of the user

#### public StreetViewPanoramaCamera getPanoramaCamera ()

Returns the current orientation and zoom

##### Returns

- The current camera

#### public boolean isPanningGesturesEnabled ()

Returns whether or not the panning gestures are enabled for the user

##### Returns

- True if panning gestures are enabled

#### public boolean isStreetNamesEnabled ()

Returns whether or not the street names appear on the panorama

##### Returns

- True if street names are shown

#### public boolean isUserNavigationEnabled ()

Returns whether or not the navigation is enabled for the user. This includes double tapping as well as using the navigation links

##### Returns

- True if navigation is enabled

#### public boolean isZoomGesturesEnabled ()

Returns whether or not the zoom gestures are enabled for the user

##### Returns

- True if zoom gestures are enabled

#### public Point orientationToPoint (StreetViewPanoramaOrientation orientation)

Returns a screen location that corresponds to an orientation (`StreetViewPanoramaOrientation`). The screen location is in screen pixels (not display pixels) relative to the top left of the Street View panorama (not of the whole screen).

##### Parameters

orientation | A `StreetViewPanoramaOrientation` on the Street View panorama to convert to a screen location.

##### Returns

- A `Point` representing the screen location in screen pixels. Returns null if the orientation is unable to be projected on the screen (e.g. behind the user's field of view)

#### public StreetViewPanoramaOrientation pointToOrientation (Point point)

Returns the orientation that corresponds to a screen location. The screen location is specified in screen pixels (not display pixels) relative to the top left of the Street View panorama (not the top left of the whole screen).

##### Parameters

point | A `Point` on the screen in screen pixels.

##### Returns

- The `StreetViewPanoramaOrientation` corresponding to the `point` on the screen, or `null` if the Street View panorama has not been initialized or if the given point is not a valid point on the screen

#### public final void setOnStreetViewPanoramaCameraChangeListener (StreetViewPanorama.OnStreetViewPanoramaCameraChangeListener listener)

Sets a callback that's invoked when the camera changes

##### Parameters

listener | The callback that's invoked when the camera changes. To unset the callback, use `null`.

#### public final void setOnStreetViewPanoramaChangeListener (StreetViewPanorama.OnStreetViewPanoramaChangeListener listener)

Sets a callback that's invoked when the panorama changes

##### Parameters

listener | The callback that's invoked when the panorama changes. To unset the callback, use `null`.

#### public final void setOnStreetViewPanoramaClickListener (StreetViewPanorama.OnStreetViewPanoramaClickListener listener)

Sets a callback that's invoked when the panorama is tapped.

##### Parameters

listener | The callback that's invoked when the panorama is tapped. To unset the callback, use `null`.

#### public void setPanningGesturesEnabled (boolean enablePanning)

Sets whether the user is able to use panning gestures

##### Parameters

enablePanning | True if users are allowed to use panning gestures

#### public void setPosition (LatLng position)

Sets the StreetViewPanorama to a given location

##### Parameters

position | Latitude and longitude of the desired location

#### public void setPosition (String panoId)

Sets the StreetViewPanorama to a given location

##### Parameters

panoId | Panorama ID of the desired location

#### public void setPosition (LatLng position, int radius)

Sets the StreetViewPanorama to a given location

##### Parameters

position | Latitude and longitude of the desired location
radius | Radius, specified in meters, that defines the area in which to search for a panorama, centered on the given latitude and longitude

#### public void setStreetNamesEnabled (boolean enableStreetNames)

Sets whether the user is able to see street names on panoramas

##### Parameters

enableStreetNames | True if users are able to see street names on panoramas

#### public void setUserNavigationEnabled (boolean enableUserNavigation)

Sets whether the user is able to move to another panorama

##### Parameters

enableUserNavigation | True if users are allowed to move to another panorama

#### public void setZoomGesturesEnabled (boolean enableZoom)

Sets whether the user is able to use zoom gestures

##### Parameters

enableZoom | True if users are allowed to use zoom gestures