public class MediaRouteDiscoveryFragment extends Fragment
This fragment takes care of registering a callback for media route discovery
during the 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.
Note that the discovery callback makes the application be connected with all the
media route provider services
while it is registered.
Fragment.InstantiationException, Fragment.SavedState
Constructor and Description |
---|
MediaRouteDiscoveryFragment() |
Modifier and Type | Method and Description |
---|---|
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.
|
dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, getLoaderManager, getParentFragment, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, hashCode, hasOptionsMenu, instantiate, instantiate, isAdded, isDetached, isHidden, isInLayout, isMenuVisible, isRemoving, isResumed, isVisible, onActivityCreated, onActivityResult, onAttach, onAttach, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreate, onCreateAnimation, onCreateContextMenu, onCreateOptionsMenu, onCreateView, onDestroy, onDestroyOptionsMenu, onDestroyView, onDetach, onHiddenChanged, onInflate, onInflate, onLowMemory, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPause, onPictureInPictureModeChanged, onPrepareOptionsMenu, onRequestPermissionsResult, onResume, onSaveInstanceState, onViewCreated, onViewStateRestored, registerForContextMenu, requestPermissions, setAllowEnterTransitionOverlap, setAllowReturnTransitionOverlap, setArguments, setEnterSharedElementCallback, setEnterTransition, setExitSharedElementCallback, setExitTransition, setHasOptionsMenu, setInitialSavedState, setMenuVisibility, setReenterTransition, setRetainInstance, setReturnTransition, setSharedElementEnterTransition, setSharedElementReturnTransition, setTargetFragment, setUserVisibleHint, shouldShowRequestPermissionRationale, startActivity, startActivity, startActivityForResult, startActivityForResult, startIntentSenderForResult, toString, unregisterForContextMenu
public MediaRouter getMediaRouter()
public MediaRouteSelector getRouteSelector()
public void setRouteSelector(MediaRouteSelector selector)
selector
- The selector to set.public MediaRouter.Callback onCreateCallback()
callback
that will be registered.
The default callback does nothing. The application may override this method to supply its own callback.
public int onPrepareCallbackFlags()
callback
is registered.
The default implementation returns MediaRouter.CALLBACK_FLAG_REQUEST_DISCOVERY
.
public void onStart()
Fragment
Activity.onStart
of the containing
Activity's lifecycle.public void onStop()
Fragment
Activity.onStop
of the containing
Activity's lifecycle.