O Google tem o compromisso de promover a igualdade racial para as comunidades negras. Saiba como.

MediaRouteDiscoveryFragment

public class MediaRouteDiscoveryFragment
extends Fragment

java.lang.Object
   ↳ androidx.fragment.app.Fragment
     ↳ androidx.mediarouter.app.MediaRouteDiscoveryFragment


Media route discovery fragment.

This fragment takes care of registering a callback with proper flags for media route discovery:

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.

Note that the discovery callback makes the application be connected with all the media route provider services while it is registered.

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.

void onCreate(Bundle savedInstanceState)

Called to do initial creation of a fragment.

MediaRouter.Callback onCreateCallback()

Called to create the callback that will be registered.

void onDestroy()

Called when the fragment is no longer in use.

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.

Inherited methods

Public constructors

MediaRouteDiscoveryFragment

public MediaRouteDiscoveryFragment ()

Public methods

getMediaRouter

public MediaRouter getMediaRouter ()

Gets the media router instance.

Returns
MediaRouter

getRouteSelector

public MediaRouteSelector getRouteSelector ()

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

Returns
MediaRouteSelector The selector, never null.

onCreate

public void onCreate (Bundle savedInstanceState)

Called to do initial creation of a fragment. This is called after onAttach(Activity) and before onCreateView(LayoutInflater, ViewGroup, Bundle).

Note that this can be called while the fragment's activity is still in the process of being created. As such, you can not rely on things like the activity's content view hierarchy being initialized at this point. If you want to do work once the activity itself is created, add a LifecycleObserver on the activity's Lifecycle, removing it when it receives the Lifecycle.State.CREATED callback.

Any restored child fragments will be created before the base Fragment.onCreate method returns.

Parameters
savedInstanceState Bundle: If the fragment is being re-created from a previous saved state, this is the state.

onCreateCallback

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
MediaRouter.Callback The new callback, or null if no callback should be registered.

onDestroy

public void onDestroy ()

Called when the fragment is no longer in use. This is called after onStop() and before onDetach().

onPrepareCallbackFlags

public int onPrepareCallbackFlags ()

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

The default implementation returns MediaRouter.CALLBACK_FLAG_REQUEST_DISCOVERY.

Returns
int The desired callback flags.

onStart

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.

onStop

public void onStop ()

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

setRouteSelector

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 MediaRouteSelector: The selector to set.