SupportStreetViewPanoramaFragment

public classSupportStreetViewPanoramaFragmentextendsFragment

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.SupportStreetViewPanoramaFragment"
android:layout_width= "match_parent"
android:layout_height= "match_parent" />
AStreetViewPanorama must be acquired using getStreetViewPanoramaAsync(OnStreetViewPanoramaReadyCallback).TheSupportStreetViewPanoramaFragment automatically initializes the Street View system and the view.

A view can be removed when the SupportStreetViewPanoramaFragment's onDestroyView()method is called and the StreetViewPanoramaOptions.useViewLifecycleInFragment(boolean)option is set. When this happens the SupportStreetViewPanoramaFragment 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 theStreetViewPanorama 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 SDK does not support multiple SupportStreetViewPanoramaFragmentobjects in one activity.

Inherited Field Summary

Public Constructor Summary

SupportStreetViewPanoramaFragment()
Creates a streetview panorama fragment.

Public Method Summary

void
getStreetViewPanoramaAsync(OnStreetViewPanoramaReadyCallback callback)
Sets a callback object which will be triggered when theStreetViewPanorama instance is ready to be used.
static SupportStreetViewPanoramaFragment
newInstance()
Creates a streetview panorama fragment, using default options.
static SupportStreetViewPanoramaFragment
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
void
void
onInflate(Activity activity,AttributeSet attrs,Bundle savedInstanceState)
Parse attributes during inflation from a view hierarchy into the arguments we handle.
void
void
void
void
void
void
void

Inherited Method Summary

Public Constructors

publicSupportStreetViewPanoramaFragment()

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

Public Methods

public voidgetStreetViewPanoramaAsync(OnStreetViewPanoramaReadyCallback callback)

Sets a callback object which will be triggered when theStreetViewPanorama 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.
  • TheStreetViewPanorama 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 benull.

public staticSupportStreetViewPanoramaFragment newInstance()

Creates a streetview panorama fragment, using default options.

public staticSupportStreetViewPanoramaFragment newInstance(StreetViewPanoramaOptions options)

Creates a streetview panorama fragment with the given options.

Parameters
options Configuration options for street view, ornullto use the default options.

public voidonActivityCreated(Bundle savedInstanceState)

public voidonAttach(Activity activity)

public voidonCreate(Bundle savedInstanceState)

publicViewonCreateView(LayoutInflater inflater,ViewGroupcontainer, Bundle savedInstanceState)

public voidonDestroy()

public voidonDestroyView()

public voidonInflate(Activityactivity, AttributeSet attrs,Bundle savedInstanceState)

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

public voidonLowMemory()

public voidonPause()

public voidonResume()

public voidonSaveInstanceState(BundleoutState)

public voidonStart()

public voidonStop()

public voidsetArguments(Bundleargs)