Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

MediaRouteChooserDialog

open class MediaRouteChooserDialog : AppCompatDialog
kotlin.Any
   ↳ android.app.Dialog
   ↳ androidx.appcompat.app.AppCompatDialog
   ↳ androidx.mediarouter.app.MediaRouteChooserDialog

This class implements the route chooser dialog for MediaRouter.

This dialog allows the user to choose a route that matches a given selector.

Summary

Public constructors

<init>(context: Context!)

<init>(context: Context!, theme: Int)

Public methods

open MediaRouteSelector

Gets the media route selector for filtering the routes that the user can select.

open Unit

open Unit

open Boolean

Returns true if the route should be included in the list.

open Unit

Called to filter the set of routes that should be included in the list.

open Unit

Refreshes the list of routes that are shown in the chooser dialog.

open Unit

Sets the media route selector for filtering the routes that the user can select.

open Unit

open Unit
setTitle(titleId: Int)

Protected methods

open Unit
onCreate(savedInstanceState: Bundle!)

Inherited functions

Public constructors

<init>

MediaRouteChooserDialog(context: Context!)

<init>

MediaRouteChooserDialog(context: Context!, theme: Int)

Public methods

getRouteSelector

@NonNull open fun getRouteSelector(): MediaRouteSelector

Gets the media route selector for filtering the routes that the user can select.

Return
MediaRouteSelector: The selector, never null.

onAttachedToWindow

open fun onAttachedToWindow(): Unit

onDetachedFromWindow

open fun onDetachedFromWindow(): Unit

onFilterRoute

open fun onFilterRoute(@NonNull route: MediaRouter.RouteInfo): Boolean

Returns true if the route should be included in the list.

The default implementation returns true for enabled non-default routes that match the selector. Subclasses can override this method to filter routes differently.

Parameters
route MediaRouter.RouteInfo: The route to consider, never null.
Return
Boolean: True if the route should be included in the chooser dialog.

onFilterRoutes

open fun onFilterRoutes(@NonNull routes: MutableList<MediaRouter.RouteInfo!>): Unit

Called to filter the set of routes that should be included in the list.

The default implementation iterates over all routes in the provided list and removes those for which onFilterRoute returns false.

Parameters
routes MutableList<MediaRouter.RouteInfo!>: The list of routes to filter in-place, never null.

refreshRoutes

open fun refreshRoutes(): Unit

Refreshes the list of routes that are shown in the chooser dialog.

setRouteSelector

open fun setRouteSelector(@NonNull selector: MediaRouteSelector): Unit

Sets the media route selector for filtering the routes that the user can select.

Parameters
selector MediaRouteSelector: The selector, must not be null.

setTitle

open fun setTitle(title: CharSequence!): Unit

setTitle

open fun setTitle(titleId: Int): Unit

Protected methods

onCreate

protected open fun onCreate(savedInstanceState: Bundle!): Unit