Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.
added in version 22.1.0
belongs to Maven artifact com.android.support:mediarouter-v7:28.0.0-alpha1

MediaRouteSelector

public final class MediaRouteSelector
extends Object

java.lang.Object
   ↳ android.support.v7.media.MediaRouteSelector


Describes the capabilities of routes that applications would like to discover and use.

This object is immutable once created using a MediaRouteSelector.Builder instance.

Example

 MediaRouteSelector selectorBuilder = new MediaRouteSelector.Builder()
         .addControlCategory(MediaControlIntent.CATEGORY_LIVE_VIDEO)
         .addControlCategory(MediaControlIntent.CATEGORY_REMOTE_PLAYBACK)
         .build();

 MediaRouter router = MediaRouter.getInstance(context);
 router.addCallback(selector, callback, MediaRouter.CALLBACK_FLAG_REQUEST_DISCOVERY);
 

Summary

Nested classes

class MediaRouteSelector.Builder

Builder for media route selectors

Fields

public static final MediaRouteSelector EMPTY

An empty media route selector that will not match any routes.

Public methods

Bundle asBundle()

Converts this object to a bundle for serialization.

boolean contains(MediaRouteSelector selector)

Returns true if this selector contains all of the capabilities described by the specified selector.

boolean equals(Object o)
static MediaRouteSelector fromBundle(Bundle bundle)

Creates an instance from a bundle.

List<String> getControlCategories()

Gets the list of media control categories in the selector.

boolean hasControlCategory(String category)

Returns true if the selector contains the specified category.

int hashCode()
boolean isEmpty()

Returns true if the selector does not specify any capabilities.

boolean isValid()

Returns true if the selector has all of the required fields.

boolean matchesControlFilters(List<IntentFilter> filters)

Returns true if the selector matches at least one of the specified control filters.

String toString()

Inherited methods

From class java.lang.Object

Fields

EMPTY

added in version 22.1.0
MediaRouteSelector EMPTY

An empty media route selector that will not match any routes.

Public methods

asBundle

added in version 22.1.0
Bundle asBundle ()

Converts this object to a bundle for serialization.

Returns
Bundle The contents of the object represented as a bundle.

contains

added in version 22.1.0
boolean contains (MediaRouteSelector selector)

Returns true if this selector contains all of the capabilities described by the specified selector.

Parameters
selector MediaRouteSelector: The selector to be examined.

Returns
boolean True if this selector contains all of the capabilities described by the specified selector.

equals

boolean equals (Object o)

Parameters
o Object

Returns
boolean

fromBundle

added in version 22.1.0
MediaRouteSelector fromBundle (Bundle bundle)

Creates an instance from a bundle.

Parameters
bundle Bundle: The bundle, or null if none.

Returns
MediaRouteSelector The new instance, or null if the bundle was null.

getControlCategories

added in version 22.1.0
List<String> getControlCategories ()

Gets the list of media control categories in the selector.

Returns
List<String> The list of categories.

hasControlCategory

added in version 22.1.0
boolean hasControlCategory (String category)

Returns true if the selector contains the specified category.

Parameters
category String: The category to check.

Returns
boolean True if the category is present.

hashCode

int hashCode ()

Returns
int

isEmpty

added in version 22.1.0
boolean isEmpty ()

Returns true if the selector does not specify any capabilities.

Returns
boolean

isValid

added in version 22.1.0
boolean isValid ()

Returns true if the selector has all of the required fields.

Returns
boolean

matchesControlFilters

added in version 22.1.0
boolean matchesControlFilters (List<IntentFilter> filters)

Returns true if the selector matches at least one of the specified control filters.

Parameters
filters List: The list of control filters to consider.

Returns
boolean True if a match is found.

toString

String toString ()

Returns
String