# StreetViewPanoramaFragment

public class **StreetViewPanoramaFragment** extends [Fragment](https://developer.android.com/reference/android/app/Fragment.html)  
A StreetViewPanorama component in an app. This fragment is the simplest way to place a
Street View panorama in an application. It's a wrapper around a view of a panorama to
automatically handle the necessary life cycle needs. Being a fragment, this component can be
added to an activity's layout file simply with the XML below.

```
 <fragment
    class="com.google.android.gms.maps.StreetViewPanoramaFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>
```
A `https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanorama` must be acquired using `https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaFragment#getStreetViewPanoramaAsync(com.google.android.gms.maps.OnStreetViewPanoramaReadyCallback)`. The `https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaFragment` automatically initializes the Street View system and the view.

A view can be removed when the StreetViewPanoramaFragment's `https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaFragment#onDestroyView()` method is called and the `https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaOptions#useViewLifecycleInFragment(boolean)` option is set. When
this happens the StreetViewPanoramaFragment is no longer valid until the view is recreated
again later when MapFragment's `https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaFragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)` method is called.

Any object obtained from the `https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanorama`
is associated with the view. It's important to not hold on to objects beyond the view's life.
Otherwise it will cause a memory leak as the view cannot be released.

Use this class only if you are targeting API 12 and above. Otherwise, use
SupportStreetViewPanoramaFragment.

Note: The Google Maps SDK for Android does not support multiple
`StreetViewPanoramaFragment` objects in one activity.

### Inherited Constant Summary

From interface android.content.ComponentCallbacks2

|---|---|---|
| int | TRIM_MEMORY_BACKGROUND |   |
| int | TRIM_MEMORY_COMPLETE |   |
| int | TRIM_MEMORY_MODERATE |   |
| int | TRIM_MEMORY_RUNNING_CRITICAL |   |
| int | TRIM_MEMORY_RUNNING_LOW |   |
| int | TRIM_MEMORY_RUNNING_MODERATE |   |
| int | TRIM_MEMORY_UI_HIDDEN |   |

### Public Constructor Summary

|---|---|
|   | [StreetViewPanoramaFragment](https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaFragment#StreetViewPanoramaFragment())() Creates a streetview panorama fragment. |

### Public Method Summary

|---|---|
| void | [getStreetViewPanoramaAsync](https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaFragment#getStreetViewPanoramaAsync(com.google.android.gms.maps.OnStreetViewPanoramaReadyCallback))([OnStreetViewPanoramaReadyCallback](https://developers.google.com/android/reference/com/google/android/gms/maps/OnStreetViewPanoramaReadyCallback) callback) Sets a callback object which will be triggered when the `https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanorama` instance is ready to be used. |
| static [StreetViewPanoramaFragment](https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaFragment) | [newInstance](https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaFragment#newInstance())() Creates a streetview panorama fragment, using default options. |
| static [StreetViewPanoramaFragment](https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaFragment) | [newInstance](https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaFragment#newInstance(com.google.android.gms.maps.StreetViewPanoramaOptions))([StreetViewPanoramaOptions](https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaOptions) options) Creates a streetview panorama fragment with the given options. |
| void | [onActivityCreated](https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaFragment#onActivityCreated(android.os.Bundle))([Bundle](https://developer.android.com/reference/android/os/Bundle.html) savedInstanceState) |
| void | [onAttach](https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaFragment#onAttach(android.app.Activity))([Activity](https://developer.android.com/reference/android/app/Activity.html) activity) |
| void | [onCreate](https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaFragment#onCreate(android.os.Bundle))([Bundle](https://developer.android.com/reference/android/os/Bundle.html) savedInstanceState) |
| [View](https://developer.android.com/reference/android/view/View.html) | [onCreateView](https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaFragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle))([LayoutInflater](https://developer.android.com/reference/android/view/LayoutInflater.html) inflater, [ViewGroup](https://developer.android.com/reference/android/view/ViewGroup.html) container, [Bundle](https://developer.android.com/reference/android/os/Bundle.html) savedInstanceState) |
| void | [onDestroy](https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaFragment#onDestroy())() |
| void | [onDestroyView](https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaFragment#onDestroyView())() |
| void | [onInflate](https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaFragment#onInflate(android.app.Activity,%20android.util.AttributeSet,%20android.os.Bundle))([Activity](https://developer.android.com/reference/android/app/Activity.html) activity, [AttributeSet](https://developer.android.com/reference/android/util/AttributeSet.html) attrs, [Bundle](https://developer.android.com/reference/android/os/Bundle.html) savedInstanceState) Parse attributes during inflation from a view hierarchy into the arguments we handle. |
| void | [onLowMemory](https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaFragment#onLowMemory())() |
| void | [onPause](https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaFragment#onPause())() |
| void | [onResume](https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaFragment#onResume())() |
| void | [onSaveInstanceState](https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaFragment#onSaveInstanceState(android.os.Bundle))([Bundle](https://developer.android.com/reference/android/os/Bundle.html) outState) |
| void | [onStart](https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaFragment#onStart())() |
| void | [onStop](https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaFragment#onStop())() |
| void | [setArguments](https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaFragment#setArguments(android.os.Bundle))([Bundle](https://developer.android.com/reference/android/os/Bundle.html) args) |

### Inherited Method Summary

From class android.app.Fragment

|---|---|
| void | dump([String](https://developer.android.com/reference/java/lang/String.html) arg0, [FileDescriptor](https://developer.android.com/reference/java/io/FileDescriptor.html) arg1, [PrintWriter](https://developer.android.com/reference/java/io/PrintWriter.html) arg2, [String\[\]](https://developer.android.com/reference/java/lang/String.html) arg3) |
| final boolean | equals([Object](https://developer.android.com/reference/java/lang/Object.html) arg0) |
| final [Activity](https://developer.android.com/reference/android/app/Activity.html) | getActivity() |
| boolean | getAllowEnterTransitionOverlap() |
| boolean | getAllowReturnTransitionOverlap() |
| final [Bundle](https://developer.android.com/reference/android/os/Bundle.html) | getArguments() |
| final [FragmentManager](https://developer.android.com/reference/android/app/FragmentManager.html) | getChildFragmentManager() |
| [Context](https://developer.android.com/reference/android/content/Context.html) | getContext() |
| [Transition](https://developer.android.com/reference/android/transition/Transition.html) | getEnterTransition() |
| [Transition](https://developer.android.com/reference/android/transition/Transition.html) | getExitTransition() |
| final [FragmentManager](https://developer.android.com/reference/android/app/FragmentManager.html) | getFragmentManager() |
| final [Object](https://developer.android.com/reference/java/lang/Object.html) | getHost() |
| final int | getId() |
| final [LayoutInflater](https://developer.android.com/reference/android/view/LayoutInflater.html) | getLayoutInflater() |
| [LoaderManager](https://developer.android.com/reference/android/app/LoaderManager.html) | getLoaderManager() |
| final [Fragment](https://developer.android.com/reference/android/app/Fragment.html) | getParentFragment() |
| [Transition](https://developer.android.com/reference/android/transition/Transition.html) | getReenterTransition() |
| final [Resources](https://developer.android.com/reference/android/content/res/Resources.html) | getResources() |
| final boolean | getRetainInstance() |
| [Transition](https://developer.android.com/reference/android/transition/Transition.html) | getReturnTransition() |
| [Transition](https://developer.android.com/reference/android/transition/Transition.html) | getSharedElementEnterTransition() |
| [Transition](https://developer.android.com/reference/android/transition/Transition.html) | getSharedElementReturnTransition() |
| final [String](https://developer.android.com/reference/java/lang/String.html) | getString(int arg0, [Object...](https://developer.android.com/reference/java/lang/Object.html) arg1) |
| final [String](https://developer.android.com/reference/java/lang/String.html) | getString(int arg0) |
| final [String](https://developer.android.com/reference/java/lang/String.html) | getTag() |
| final [Fragment](https://developer.android.com/reference/android/app/Fragment.html) | getTargetFragment() |
| final int | getTargetRequestCode() |
| final [CharSequence](https://developer.android.com/reference/java/lang/CharSequence.html) | getText(int arg0) |
| boolean | getUserVisibleHint() |
| [View](https://developer.android.com/reference/android/view/View.html) | getView() |
| final int | hashCode() |
| static [Fragment](https://developer.android.com/reference/android/app/Fragment.html) | instantiate([Context](https://developer.android.com/reference/android/content/Context.html) arg0, [String](https://developer.android.com/reference/java/lang/String.html) arg1) |
| static [Fragment](https://developer.android.com/reference/android/app/Fragment.html) | instantiate([Context](https://developer.android.com/reference/android/content/Context.html) arg0, [String](https://developer.android.com/reference/java/lang/String.html) arg1, [Bundle](https://developer.android.com/reference/android/os/Bundle.html) arg2) |
| final boolean | isAdded() |
| final boolean | isDetached() |
| final boolean | isHidden() |
| final boolean | isInLayout() |
| final boolean | isRemoving() |
| final boolean | isResumed() |
| final boolean | isStateSaved() |
| final boolean | isVisible() |
| void | onActivityCreated([Bundle](https://developer.android.com/reference/android/os/Bundle.html) arg0) |
| void | onActivityResult(int arg0, int arg1, [Intent](https://developer.android.com/reference/android/content/Intent.html) arg2) |
| void | onAttach([Activity](https://developer.android.com/reference/android/app/Activity.html) arg0) |
| void | onAttach([Context](https://developer.android.com/reference/android/content/Context.html) arg0) |
| void | onAttachFragment([Fragment](https://developer.android.com/reference/android/app/Fragment.html) arg0) |
| void | onConfigurationChanged([Configuration](https://developer.android.com/reference/android/content/res/Configuration.html) arg0) |
| boolean | onContextItemSelected([MenuItem](https://developer.android.com/reference/android/view/MenuItem.html) arg0) |
| void | onCreate([Bundle](https://developer.android.com/reference/android/os/Bundle.html) arg0) |
| [Animator](https://developer.android.com/reference/android/animation/Animator.html) | onCreateAnimator(int arg0, boolean arg1, int arg2) |
| void | onCreateContextMenu([ContextMenu](https://developer.android.com/reference/android/view/ContextMenu.html) arg0, [View](https://developer.android.com/reference/android/view/View.html) arg1, [ContextMenu.ContextMenuInfo](https://developer.android.com/reference/android/view/ContextMenu.ContextMenuInfo.html) arg2) |
| void | onCreateOptionsMenu([Menu](https://developer.android.com/reference/android/view/Menu.html) arg0, [MenuInflater](https://developer.android.com/reference/android/view/MenuInflater.html) arg1) |
| [View](https://developer.android.com/reference/android/view/View.html) | onCreateView([LayoutInflater](https://developer.android.com/reference/android/view/LayoutInflater.html) arg0, [ViewGroup](https://developer.android.com/reference/android/view/ViewGroup.html) arg1, [Bundle](https://developer.android.com/reference/android/os/Bundle.html) arg2) |
| void | onDestroy() |
| void | onDestroyOptionsMenu() |
| void | onDestroyView() |
| void | onDetach() |
| [LayoutInflater](https://developer.android.com/reference/android/view/LayoutInflater.html) | onGetLayoutInflater([Bundle](https://developer.android.com/reference/android/os/Bundle.html) arg0) |
| void | onHiddenChanged(boolean arg0) |
| void | onInflate([AttributeSet](https://developer.android.com/reference/android/util/AttributeSet.html) arg0, [Bundle](https://developer.android.com/reference/android/os/Bundle.html) arg1) |
| void | onInflate([Activity](https://developer.android.com/reference/android/app/Activity.html) arg0, [AttributeSet](https://developer.android.com/reference/android/util/AttributeSet.html) arg1, [Bundle](https://developer.android.com/reference/android/os/Bundle.html) arg2) |
| void | onInflate([Context](https://developer.android.com/reference/android/content/Context.html) arg0, [AttributeSet](https://developer.android.com/reference/android/util/AttributeSet.html) arg1, [Bundle](https://developer.android.com/reference/android/os/Bundle.html) arg2) |
| void | onLowMemory() |
| void | onMultiWindowModeChanged(boolean arg0) |
| void | onMultiWindowModeChanged(boolean arg0, [Configuration](https://developer.android.com/reference/android/content/res/Configuration.html) arg1) |
| boolean | onOptionsItemSelected([MenuItem](https://developer.android.com/reference/android/view/MenuItem.html) arg0) |
| void | onOptionsMenuClosed([Menu](https://developer.android.com/reference/android/view/Menu.html) arg0) |
| void | onPause() |
| void | onPictureInPictureModeChanged(boolean arg0, [Configuration](https://developer.android.com/reference/android/content/res/Configuration.html) arg1) |
| void | onPictureInPictureModeChanged(boolean arg0) |
| void | onPrepareOptionsMenu([Menu](https://developer.android.com/reference/android/view/Menu.html) arg0) |
| void | onRequestPermissionsResult(int arg0, [String\[\]](https://developer.android.com/reference/java/lang/String.html) arg1, int\[\] arg2) |
| void | onResume() |
| void | onSaveInstanceState([Bundle](https://developer.android.com/reference/android/os/Bundle.html) arg0) |
| void | onStart() |
| void | onStop() |
| void | onTrimMemory(int arg0) |
| void | onViewCreated([View](https://developer.android.com/reference/android/view/View.html) arg0, [Bundle](https://developer.android.com/reference/android/os/Bundle.html) arg1) |
| void | onViewStateRestored([Bundle](https://developer.android.com/reference/android/os/Bundle.html) arg0) |
| void | postponeEnterTransition() |
| void | registerForContextMenu([View](https://developer.android.com/reference/android/view/View.html) arg0) |
| final void | requestPermissions([String\[\]](https://developer.android.com/reference/java/lang/String.html) arg0, int arg1) |
| void | setAllowEnterTransitionOverlap(boolean arg0) |
| void | setAllowReturnTransitionOverlap(boolean arg0) |
| void | setArguments([Bundle](https://developer.android.com/reference/android/os/Bundle.html) arg0) |
| void | setEnterSharedElementCallback([SharedElementCallback](https://developer.android.com/reference/android/app/SharedElementCallback.html) arg0) |
| void | setEnterTransition([Transition](https://developer.android.com/reference/android/transition/Transition.html) arg0) |
| void | setExitSharedElementCallback([SharedElementCallback](https://developer.android.com/reference/android/app/SharedElementCallback.html) arg0) |
| void | setExitTransition([Transition](https://developer.android.com/reference/android/transition/Transition.html) arg0) |
| void | setHasOptionsMenu(boolean arg0) |
| void | setInitialSavedState([Fragment.SavedState](https://developer.android.com/reference/android/app/Fragment.SavedState.html) arg0) |
| void | setMenuVisibility(boolean arg0) |
| void | setReenterTransition([Transition](https://developer.android.com/reference/android/transition/Transition.html) arg0) |
| void | setRetainInstance(boolean arg0) |
| void | setReturnTransition([Transition](https://developer.android.com/reference/android/transition/Transition.html) arg0) |
| void | setSharedElementEnterTransition([Transition](https://developer.android.com/reference/android/transition/Transition.html) arg0) |
| void | setSharedElementReturnTransition([Transition](https://developer.android.com/reference/android/transition/Transition.html) arg0) |
| void | setTargetFragment([Fragment](https://developer.android.com/reference/android/app/Fragment.html) arg0, int arg1) |
| void | setUserVisibleHint(boolean arg0) |
| boolean | shouldShowRequestPermissionRationale([String](https://developer.android.com/reference/java/lang/String.html) arg0) |
| void | startActivity([Intent](https://developer.android.com/reference/android/content/Intent.html) arg0) |
| void | startActivity([Intent](https://developer.android.com/reference/android/content/Intent.html) arg0, [Bundle](https://developer.android.com/reference/android/os/Bundle.html) arg1) |
| void | startActivityForResult([Intent](https://developer.android.com/reference/android/content/Intent.html) arg0, int arg1) |
| void | startActivityForResult([Intent](https://developer.android.com/reference/android/content/Intent.html) arg0, int arg1, [Bundle](https://developer.android.com/reference/android/os/Bundle.html) arg2) |
| void | startIntentSenderForResult([IntentSender](https://developer.android.com/reference/android/content/IntentSender.html) arg0, int arg1, [Intent](https://developer.android.com/reference/android/content/Intent.html) arg2, int arg3, int arg4, int arg5, [Bundle](https://developer.android.com/reference/android/os/Bundle.html) arg6) |
| void | startPostponedEnterTransition() |
| [String](https://developer.android.com/reference/java/lang/String.html) | toString() |
| void | unregisterForContextMenu([View](https://developer.android.com/reference/android/view/View.html) arg0) |

From class java.lang.Object

|---|---|
| [Object](https://developer.android.com/reference/java/lang/Object.html) | clone() |
| boolean | equals([Object](https://developer.android.com/reference/java/lang/Object.html) arg0) |
| void | finalize() |
| final [Class](https://developer.android.com/reference/java/lang/Class.html)\<?\> | getClass() |
| int | hashCode() |
| final void | notify() |
| final void | notifyAll() |
| [String](https://developer.android.com/reference/java/lang/String.html) | toString() |
| final void | wait(long arg0, int arg1) |
| final void | wait(long arg0) |
| final void | wait() |

From interface android.content.ComponentCallbacks2

|---|---|
| abstract void | onTrimMemory(int arg0) |

From interface android.view.View.OnCreateContextMenuListener

|---|---|
| abstract void | onCreateContextMenu([ContextMenu](https://developer.android.com/reference/android/view/ContextMenu.html) arg0, [View](https://developer.android.com/reference/android/view/View.html) arg1, [ContextMenu.ContextMenuInfo](https://developer.android.com/reference/android/view/ContextMenu.ContextMenuInfo.html) arg2) |

From interface android.content.ComponentCallbacks

|---|---|
| abstract void | onConfigurationChanged([Configuration](https://developer.android.com/reference/android/content/res/Configuration.html) arg0) |
| abstract void | onLowMemory() |

## Public Constructors

#### public **StreetViewPanoramaFragment** ()

Creates a streetview panorama fragment. This constructor is public only for use by
an inflater. Use `https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaFragment#newInstance()` to create a StreetViewPanoramaFragment programmatically.

## Public Methods

#### public void **getStreetViewPanoramaAsync** ([OnStreetViewPanoramaReadyCallback](https://developers.google.com/android/reference/com/google/android/gms/maps/OnStreetViewPanoramaReadyCallback) callback)

Sets a callback object which will be triggered when the `https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanorama`
instance is ready to be used.

Note that:

- In the case where Google Play services is not installed on the user's device, the callback will not be triggered until the user installs it.
- The callback will be executed in the main thread.
- The `https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanorama` object provided by the callback is non-null.

##### Parameters

| callback | The callback object that will be triggered when the panorama is ready to be used. Must not be `null`. |
|---|---|

#### public static [StreetViewPanoramaFragment](https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaFragment)
**newInstance** ()

Creates a streetview panorama fragment, using default options.

#### public static [StreetViewPanoramaFragment](https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaFragment)
**newInstance** ([StreetViewPanoramaOptions](https://developers.google.com/android/reference/com/google/android/gms/maps/StreetViewPanoramaOptions) options)

Creates a streetview panorama fragment with the given options.

##### Parameters

| options | Configuration options for street view, or `null` to use the default options. |
|---|---|

#### public void **onActivityCreated** ([Bundle](https://developer.android.com/reference/android/os/Bundle.html) savedInstanceState)

#### public void **onAttach** ([Activity](https://developer.android.com/reference/android/app/Activity.html) activity)

#### public void **onCreate** ([Bundle](https://developer.android.com/reference/android/os/Bundle.html) savedInstanceState)

#### public [View](https://developer.android.com/reference/android/view/View.html) **onCreateView** ([LayoutInflater](https://developer.android.com/reference/android/view/LayoutInflater.html) inflater, [ViewGroup](https://developer.android.com/reference/android/view/ViewGroup.html) container, [Bundle](https://developer.android.com/reference/android/os/Bundle.html) savedInstanceState)

#### public void **onDestroy** ()

#### public void **onDestroyView** ()

#### public void **onInflate** ([Activity](https://developer.android.com/reference/android/app/Activity.html) activity, [AttributeSet](https://developer.android.com/reference/android/util/AttributeSet.html) attrs, [Bundle](https://developer.android.com/reference/android/os/Bundle.html) savedInstanceState)

Parse attributes during inflation from a view hierarchy into the arguments we
handle.

#### public void **onLowMemory** ()

#### public void **onPause** ()

#### public void **onResume** ()

#### public void **onSaveInstanceState** ([Bundle](https://developer.android.com/reference/android/os/Bundle.html) outState)

#### public void **onStart** ()

#### public void **onStop** ()

#### public void **setArguments** ([Bundle](https://developer.android.com/reference/android/os/Bundle.html) args)