Summary: Inherited Constants | Ctors | Methods | Inherited Methods | [Expand All]
public class

# StreetViewPanoramaFragment

extends Fragment

java.lang.Object
↳ | android.app.Fragment
| ↳ | com.google.android.gms.maps.StreetViewPanoramaFragment

## Class Overview

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 `StreetViewPanorama` must be acquired using `getStreetViewPanoramaAsync(OnStreetViewPanoramaReadyCallback)`. The `StreetViewPanoramaFragment` automatically initializes the Street View system and the view.

A view can be removed when the StreetViewPanoramaFragment's `onDestroyView()` method is called and the `useViewLifecycleInFragment(boolean)` option is set. When this happens the StreetViewPanoramaFragment is no longer valid until the view is recreated again later when MapFragment's `onCreateView(LayoutInflater, ViewGroup, Bundle)` method is called.

Any object obtained from the `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 Android API does not support multiple `StreetViewPanoramaFragment` objects in one activity.

## Summary

[Expand] Inherited Constants
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 Constructors
| StreetViewPanoramaFragment() Creates a streetview panorama fragment.

Public Methods
final StreetViewPanorama | getStreetViewPanorama() This method is deprecated. Use `getStreetViewPanoramaAsync(OnStreetViewPanoramaReadyCallback)` instead. The callback method provides you with a `StreetViewPanorama` instance guaranteed to be non-null and ready to be used.
void | getStreetViewPanoramaAsync(OnStreetViewPanoramaReadyCallback callback) Sets a callback object which will be triggered when the `StreetViewPanorama` instance is ready to be used.
static StreetViewPanoramaFragment | newInstance() Creates a streetview panorama fragment, using default options.
static StreetViewPanoramaFragment | newInstance(StreetViewPanoramaOptions options) Creates a streetview panorama fragment with the given options.
void | onActivityCreated(Bundle savedInstanceState)
void | onAttach(Activity activity)
void | onCreate(Bundle savedInstanceState)
View | onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
void | onDestroy()
void | onDestroyView()
void | onInflate(Activity activity, AttributeSet attrs, Bundle savedInstanceState) Parse attributes during inflation from a view hierarchy into the arguments we handle.
void | onLowMemory()
void | onPause()
void | onResume()
void | onSaveInstanceState(Bundle outState)
void | setArguments(Bundle args)

[Expand] Inherited Methods
From class android.app.Fragment
void | dump(String arg0, FileDescriptor arg1, PrintWriter arg2, String[] arg3)
final boolean | equals(Object arg0)
final Activity | getActivity()
boolean | getAllowEnterTransitionOverlap()
boolean | getAllowReturnTransitionOverlap()
final Bundle | getArguments()
final FragmentManager | getChildFragmentManager()
Context | getContext()
Transition | getEnterTransition()
Transition | getExitTransition()
final FragmentManager | getFragmentManager()
final Object | getHost()
final int | getId()
LoaderManager | getLoaderManager()
final Fragment | getParentFragment()
Transition | getReenterTransition()
final Resources | getResources()
final boolean | getRetainInstance()
Transition | getReturnTransition()
Transition | getSharedElementEnterTransition()
Transition | getSharedElementReturnTransition()
final String | getString(int arg0, Object... arg1)
final String | getString(int arg0)
final String | getTag()
final Fragment | getTargetFragment()
final int | getTargetRequestCode()
final CharSequence | getText(int arg0)
boolean | getUserVisibleHint()
View | getView()
final int | hashCode()
static Fragment | instantiate(Context arg0, String arg1)
static Fragment | instantiate(Context arg0, String arg1, Bundle arg2)
final boolean | isAdded()
final boolean | isDetached()
final boolean | isHidden()
final boolean | isInLayout()
final boolean | isRemoving()
final boolean | isResumed()
final boolean | isVisible()
void | onActivityCreated(Bundle arg0)
void | onActivityResult(int arg0, int arg1, Intent arg2)
void | onAttach(Activity arg0)
void | onAttach(Context arg0)
void | onConfigurationChanged(Configuration arg0)
boolean | onContextItemSelected(MenuItem arg0)
void | onCreate(Bundle arg0)
Animator | onCreateAnimator(int arg0, boolean arg1, int arg2)
void | onCreateContextMenu(ContextMenu arg0, View arg1, ContextMenu.ContextMenuInfo arg2)
void | onCreateOptionsMenu(Menu arg0, MenuInflater arg1)
View | onCreateView(LayoutInflater arg0, ViewGroup arg1, Bundle arg2)
void | onDestroy()
void | onDestroyOptionsMenu()
void | onDestroyView()
void | onDetach()
void | onHiddenChanged(boolean arg0)
void | onInflate(AttributeSet arg0, Bundle arg1)
void | onInflate(Activity arg0, AttributeSet arg1, Bundle arg2)
void | onInflate(Context arg0, AttributeSet arg1, Bundle arg2)
void | onLowMemory()
boolean | onOptionsItemSelected(MenuItem arg0)
void | onOptionsMenuClosed(Menu arg0)
void | onPause()
void | onPrepareOptionsMenu(Menu arg0)
void | onRequestPermissionsResult(int arg0, String[] arg1, int[] arg2)
void | onResume()
void | onSaveInstanceState(Bundle arg0)
void | onStart()
void | onStop()
void | onTrimMemory(int arg0)
void | onViewCreated(View arg0, Bundle arg1)
void | onViewStateRestored(Bundle arg0)
void | registerForContextMenu(View arg0)
final void | requestPermissions(String[] arg0, int arg1)
void | setAllowEnterTransitionOverlap(boolean arg0)
void | setAllowReturnTransitionOverlap(boolean arg0)
void | setArguments(Bundle arg0)
void | setEnterSharedElementCallback(SharedElementCallback arg0)
void | setEnterTransition(Transition arg0)
void | setExitSharedElementCallback(SharedElementCallback arg0)
void | setExitTransition(Transition arg0)
void | setHasOptionsMenu(boolean arg0)
void | setInitialSavedState(Fragment.SavedState arg0)
void | setMenuVisibility(boolean arg0)
void | setReenterTransition(Transition arg0)
void | setRetainInstance(boolean arg0)
void | setReturnTransition(Transition arg0)
void | setSharedElementEnterTransition(Transition arg0)
void | setSharedElementReturnTransition(Transition arg0)
void | setTargetFragment(Fragment arg0, int arg1)
void | setUserVisibleHint(boolean arg0)
boolean | shouldShowRequestPermissionRationale(String arg0)
void | startActivity(Intent arg0)
void | startActivity(Intent arg0, Bundle arg1)
void | startActivityForResult(Intent arg0, int arg1)
void | startActivityForResult(Intent arg0, int arg1, Bundle arg2)
String | toString()
void | unregisterForContextMenu(View arg0)
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(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 arg0, View arg1, ContextMenu.ContextMenuInfo arg2)
From interface android.content.ComponentCallbacks
abstract void | onConfigurationChanged(Configuration arg0)
abstract void | onLowMemory()

## Public Constructors

#### public StreetViewPanoramaFragment ()

Creates a streetview panorama fragment. This constructor is public only for use by an inflater. Use `newInstance()` to create a StreetViewPanoramaFragment programmatically.

## Public Methods

#### public final StreetViewPanorama getStreetViewPanorama ()

This method is deprecated.
Use `getStreetViewPanoramaAsync(OnStreetViewPanoramaReadyCallback)` instead. The callback method provides you with a `StreetViewPanorama` instance guaranteed to be non-null and ready to be used.

Gets the underlying StreetViewPanorama that is tied to the view wrapped by this fragment.

##### Returns

- the StreetViewPanorama. Null if the view of the fragment is not yet ready. This can happen if the fragment lifecyle have not gone through `onCreateView(LayoutInflater, ViewGroup, Bundle)` yet. This can also happen if Google Play services is not available. If Google Play services becomes available afterwards and the fragment have gone through `onCreateView(LayoutInflater, ViewGroup, Bundle)`, calling this method again will initialize and return the StreetViewPanorama.

#### public void getStreetViewPanoramaAsync (OnStreetViewPanoramaReadyCallback callback)

Sets a callback object which will be triggered when the `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 `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.

#### public static StreetViewPanoramaFragment newInstance ()

Creates a streetview panorama fragment, using default options.

#### public static StreetViewPanoramaFragment newInstance (StreetViewPanoramaOptions options)

Creates a streetview panorama fragment with the given options.

#### public void onActivityCreated (Bundle savedInstanceState)

#### public void onAttach (Activity activity)

#### public void onCreate (Bundle savedInstanceState)

#### public View onCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)

#### public void onDestroy ()

#### public void onDestroyView ()

#### public void onInflate (Activity activity, AttributeSet attrs, Bundle 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 outState)

#### public void setArguments (Bundle args)