MediaRouteSelector
public
final
class
MediaRouteSelector
extends Object
java.lang.Object | |
↳ | androidx.mediarouter.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 |
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 |
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 | |
---|---|
Fields
EMPTY
public static final MediaRouteSelector EMPTY
An empty media route selector that will not match any routes.
Public methods
asBundle
public Bundle asBundle ()
Converts this object to a bundle for serialization.
Returns | |
---|---|
Bundle |
The contents of the object represented as a bundle. |
contains
public 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
public boolean equals (Object o)
Parameters | |
---|---|
o |
Object |
Returns | |
---|---|
boolean |
fromBundle
public static 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
public List<String> getControlCategories ()
Gets the list of media control categories
in the selector.
Returns | |
---|---|
List<String> |
The list of categories. |
hasControlCategory
public 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
public int hashCode ()
Returns | |
---|---|
int |
isEmpty
public boolean isEmpty ()
Returns true if the selector does not specify any capabilities.
Returns | |
---|---|
boolean |
isValid
public boolean isValid ()
Returns true if the selector has all of the required fields.
Returns | |
---|---|
boolean |
matchesControlFilters
public 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
public String toString ()
Returns | |
---|---|
String |
Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-09-30 UTC.