MediaRouteChooserDialog

public class MediaRouteChooserDialog extends AppCompatDialog


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

MediaRouteChooserDialog(@NonNull Context context, int theme)

Public methods

void
@NonNull MediaRouteSelector

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

void
void
boolean

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

void

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

void

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

void

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

void
void
setTitle(int titleId)

Protected methods

void
onCreate(@Nullable Bundle savedInstanceState)

Inherited Constants

From android.content.DialogInterface
static final int
BUTTON1 = -1

This field is deprecated.

static final int
BUTTON2 = -2

This field is deprecated.

static final int
BUTTON3 = -3

This field is deprecated.

static final int
static final int
static final int

Inherited fields

From androidx.activity.ComponentDialog
final OnBackPressedDispatcher

The OnBackPressedDispatcher that should handle the system back button.

Inherited methods

From androidx.appcompat.app.AppCompatDialog
void
boolean
@Nullable T
<T extends View> findViewById(@IdRes int id)
@NonNull AppCompatDelegate
ActionBar

Support library version of getActionBar.

void
void

Called when a support action mode has finished.

void

Called when a support action mode has been started.

@Nullable ActionMode

Called when a support action mode is being started for this window.

void
setContentView(@LayoutRes int layoutResID)
void
void
boolean

Enable extended support library window features.

From androidx.activity.ComponentDialog
void
Lifecycle

Returns the Lifecycle of the provider.

final OnBackPressedDispatcher

The OnBackPressedDispatcher that should handle the system back button.

SavedStateRegistry

The SavedStateRegistry owned by this SavedStateRegistryOwner

void

Sets the view tree owners before setting the content view so that the inflation process and attach listeners will see them already present.

void

This method is deprecated.

void
onCreate(Bundle savedInstanceState)
Bundle
void
void
void
setContentView(int layoutResID)
From android.app.Dialog
void
void
void
void
void
boolean
boolean
boolean
boolean
boolean
boolean
T
<T extends View> findViewById(int id)
ActionBar
final Context
View
LayoutInflater
OnBackInvokedDispatcher
final Activity
final SearchEvent
final int
Window
void
void
boolean
void
void
void

This method is deprecated.

void
boolean
void
void
onCreate(Bundle savedInstanceState)
void
onCreateContextMenu(
    ContextMenu menu,
    View v,
    ContextMenu.ContextMenuInfo menuInfo
)
boolean
boolean
onCreatePanelMenu(int featureId, Menu menu)
View
onCreatePanelView(int featureId)
boolean
boolean
onKeyDown(int keyCode, KeyEvent event)
boolean
onKeyLongPress(int keyCode, KeyEvent event)
boolean
onKeyMultiple(int keyCode, int repeatCount, KeyEvent event)
boolean
onKeyShortcut(int keyCode, KeyEvent event)
boolean
onKeyUp(int keyCode, KeyEvent event)
boolean
onMenuItemSelected(int featureId, MenuItem item)
boolean
onMenuOpened(int featureId, Menu menu)
boolean
void
void
onPanelClosed(int featureId, Menu menu)
boolean
boolean
onPreparePanel(int featureId, View view, Menu menu)
void
onRestoreInstanceState(Bundle savedInstanceState)
Bundle
boolean
void
void
boolean
boolean
void
void
onWindowFocusChanged(boolean hasFocus)
ActionMode
void
void
void
final boolean
requestWindowFeature(int featureId)
final T
<T extends View> requireViewById(int id)
void
void
setCancelable(boolean flag)
void
setCanceledOnTouchOutside(boolean cancel)
void
setContentView(int layoutResID)
void
final void
setFeatureDrawable(int featureId, Drawable drawable)
final void
setFeatureDrawableAlpha(int featureId, int alpha)
final void
setFeatureDrawableResource(int featureId, int resId)
final void
setFeatureDrawableUri(int featureId, Uri uri)
void
void
void
void
final void
void
final void
setVolumeControlStream(int streamType)
void
void
takeKeyEvents(boolean get)
void
From android.view.Window.Callback
void
onPointerCaptureChanged(boolean hasCapture)
void
onProvideKeyboardShortcuts(
    List<KeyboardShortcutGroup> data,
    Menu menu,
    int deviceId
)

Public constructors

MediaRouteChooserDialog

Added in 1.1.0
public MediaRouteChooserDialog(@NonNull Context context)

MediaRouteChooserDialog

Added in 1.1.0
public MediaRouteChooserDialog(@NonNull Context context, int theme)

Public methods

dismiss

public void dismiss()

getRouteSelector

Added in 1.1.0
public @NonNull MediaRouteSelector getRouteSelector()

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

Returns
@NonNull MediaRouteSelector

The selector, never null.

onAttachedToWindow

public void onAttachedToWindow()

onDetachedFromWindow

public void onDetachedFromWindow()

onFilterRoute

Added in 1.1.0
public boolean onFilterRoute(@NonNull MediaRouter.RouteInfo route)

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
@NonNull MediaRouter.RouteInfo route

The route to consider, never null.

Returns
boolean

True if the route should be included in the chooser dialog.

onFilterRoutes

Added in 1.1.0
public void onFilterRoutes(@NonNull List<MediaRouter.RouteInfo> routes)

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
@NonNull List<MediaRouter.RouteInfo> routes

The list of routes to filter in-place, never null.

refreshRoutes

Added in 1.1.0
public void refreshRoutes()

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

setRouteSelector

Added in 1.1.0
public void setRouteSelector(@NonNull MediaRouteSelector selector)

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

Parameters
@NonNull MediaRouteSelector selector

The selector, must not be null.

setTitle

public void setTitle(@Nullable CharSequence title)

setTitle

public void setTitle(int titleId)

Protected methods

onCreate

protected void onCreate(@Nullable Bundle savedInstanceState)