Skip to content

Most visited

Recently visited

navigation

VideoFragment

public class VideoFragment
extends PlaybackFragment

java.lang.Object
   ↳ android.app.Fragment
     ↳ android.support.v17.leanback.app.PlaybackFragment
       ↳ android.support.v17.leanback.app.VideoFragment


Subclass of PlaybackFragment that is responsible for providing a SurfaceView and rendering video.

Summary

Inherited XML attributes

From class android.app.Fragment

Inherited constants

From class android.support.v17.leanback.app.PlaybackFragment
From interface android.content.ComponentCallbacks2

Public constructors

VideoFragment()

Public methods

SurfaceView getSurfaceView()

Returns the surface view.

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

Called to have the fragment instantiate its user interface view.

void onDestroyView()

Called when the view previously created by onCreateView(LayoutInflater, ViewGroup, Bundle) has been detached from the fragment.

void setSurfaceHolderCallback(SurfaceHolder.Callback callback)

Adds SurfaceHolder.Callback to SurfaceView.

Protected methods

void onVideoSizeChanged(int width, int height)

Called when size of the video changes.

Inherited methods

From class android.support.v17.leanback.app.PlaybackFragment
From class android.app.Fragment
From class java.lang.Object
From interface android.content.ComponentCallbacks2
From interface android.view.View.OnCreateContextMenuListener
From interface android.content.ComponentCallbacks

Public constructors

VideoFragment

added in version 25.3.0
VideoFragment ()

Public methods

getSurfaceView

added in version 25.3.0
SurfaceView getSurfaceView ()

Returns the surface view.

Returns
SurfaceView

onCreateView

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

Called to have the fragment instantiate its user interface view. This is optional, and non-graphical fragments can return null (which is the default implementation). This will be called between onCreate(Bundle) and onActivityCreated(Bundle).

If you return a View from here, you will later be called in onDestroyView() when the view is being released.

Parameters
inflater LayoutInflater: The LayoutInflater object that can be used to inflate any views in the fragment,

container ViewGroup: If non-null, this is the parent view that the fragment's UI should be attached to. The fragment should not add the view itself, but this can be used to generate the LayoutParams of the view.

savedInstanceState Bundle: If non-null, this fragment is being re-constructed from a previous saved state as given here.

Returns
View Return the View for the fragment's UI, or null.

onDestroyView

void onDestroyView ()

Called when the view previously created by onCreateView(LayoutInflater, ViewGroup, Bundle) has been detached from the fragment. The next time the fragment needs to be displayed, a new view will be created. This is called after onStop() and before onDestroy(). It is called regardless of whether onCreateView(LayoutInflater, ViewGroup, Bundle) returned a non-null view. Internally it is called after the view's state has been saved but before it has been removed from its parent.

setSurfaceHolderCallback

added in version 25.3.0
void setSurfaceHolderCallback (SurfaceHolder.Callback callback)

Adds SurfaceHolder.Callback to SurfaceView.

Parameters
callback SurfaceHolder.Callback

Protected methods

onVideoSizeChanged

void onVideoSizeChanged (int width, 
                int height)

Called when size of the video changes. App may override.

Parameters
width int: Intrinsic width of video

height int: Intrinsic height of video

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.