Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
public class

MediaRouteDiscoveryFragment

extends Fragment
java.lang.Object
   ↳ android.support.v4.app.Fragment
     ↳ android.support.v7.app.MediaRouteDiscoveryFragment

Class Overview

Media route discovery fragment.

This fragment takes care of registering a callback for media route discovery during the activity's onStart() phase and removing it during the onStop() phase.

The application must supply a route selector to specify the kinds of routes to discover. The application may also override onCreateCallback() to provide the MediaRouter callback to register.

Summary

Public Constructors
MediaRouteDiscoveryFragment ()
Public Methods
MediaRouter getMediaRouter ()
Gets the media router instance.
MediaRouteSelector getRouteSelector ()
Gets the media route selector for filtering the routes to be discovered.
MediaRouter.Callback onCreateCallback ()
Called to create the callback that will be registered.
int onPrepareCallbackFlags ()
Called to prepare the callback flags that will be used when the callback is registered.
void onStart ()
Called when the Fragment is visible to the user.
void onStop ()
Called when the Fragment is no longer started.
void setRouteSelector ( MediaRouteSelector selector)
Sets the media route selector for filtering the routes to be discovered.
[Expand]
Inherited Methods
From class android.support.v4.app.Fragment
From class java.lang.Object
From interface android.content.ComponentCallbacks
From interface android.view.View.OnCreateContextMenuListener

Public Constructors

public MediaRouteDiscoveryFragment ()

Public Methods

public MediaRouter getMediaRouter ()

Gets the media router instance.

public MediaRouteSelector getRouteSelector ()

Gets the media route selector for filtering the routes to be discovered.

Returns
  • The selector, never null.

public MediaRouter.Callback onCreateCallback ()

Called to create the callback that will be registered.

The default callback does nothing. The application may override this method to supply its own callback.

Returns
  • The new callback, or null if no callback should be registered.

public int onPrepareCallbackFlags ()

Called to prepare the callback flags that will be used when the callback is registered.

The default implementation returns CALLBACK_FLAG_REQUEST_DISCOVERY .

Returns
  • The desired callback flags.

public void onStart ()

Called when the Fragment is visible to the user. This is generally tied to Activity.onStart of the containing Activity's lifecycle.

public void onStop ()

Called when the Fragment is no longer started. This is generally tied to Activity.onStop of the containing Activity's lifecycle.

public void setRouteSelector ( MediaRouteSelector selector)

Sets the media route selector for filtering the routes to be discovered. This method must be called before the fragment is added.

Parameters
selector The selector to set.