public class

StreetViewPanoramaFragment

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

Class Overview

A StreeViewPanorama 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 can only be acquired using getStreetViewPanorama() when the underlying Street View system is loaded and the underlying view in the fragment exists. The StreetViewPanoramaFragment automatically initializes the Street View system and the view; however you cannot be guaranteed when it will be ready because this depends on the availability of the Google Play services APK. If a StreetViewPanorama is not available, getStreetViewPanorama() will return null.

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.

Summary

[Expand]
Inherited Constants
From interface android.content.ComponentCallbacks2
Public Constructors
StreetViewPanoramaFragment()
Creates a streetview panorama fragment.
Public Methods
final StreetViewPanorama getStreetViewPanorama()
Gets the underlying StreetViewPanorama that is tied to the view wrapped by this fragment.
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
From class java.lang.Object
From interface android.content.ComponentCallbacks
From interface android.content.ComponentCallbacks2
From interface android.view.View.OnCreateContextMenuListener

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 ()

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

Returns

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)