# MediaRouteSelector

# MediaRouteSelector

Artifact:[androidx.mediarouter:mediarouter](https://developer.android.com/jetpack/androidx/releases/mediarouter)  
[View Source](https://cs.android.com/search?q=file:androidx/mediarouter/media/MediaRouteSelector.java+class:androidx.mediarouter.media.MediaRouteSelector)  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/mediarouter/media/MediaRouteSelector "View this page in Java")

<br />

```
class MediaRouteSelector
```

<br />

*** ** * ** ***

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

This object is immutable once created using a[Builder](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteSelector.Builder)instance.

### Example

```kotlin
MediaRouteSelector selector = 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 types                                                                                                                               |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `class `[MediaRouteSelector.Builder](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteSelector.Builder) Builder for[media route selectors](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteSelector). |

|                                                         ### Constants                                                         |
|-------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `const `[MediaRouteSelector](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteSelector)`!` | [EMPTY](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteSelector#EMPTY()) An empty media route selector that will not match any routes. |

|                                                                                                                                    ### Public functions                                                                                                                                     |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Bundle](https://developer.android.com/reference/android/os/Bundle.html)                                                                                                                                                                                                                    | [asBundle](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteSelector#asBundle())`()` Converts this object to a bundle for serialization.                                                                                                                                                                                                                                                                                                                                                                                                                  |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                                                                                                                                         | [contains](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteSelector#contains(androidx.mediarouter.media.MediaRouteSelector))`(selector: `[MediaRouteSelector](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteSelector)`)` Returns true if this selector contains all of the capabilities described by the specified selector.                                                                                                                                                                                       |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                                                                                                                                         | [equals](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteSelector#equals(java.lang.Object))`(o: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`!)`                                                                                                                                                                                                                                                                                                                                                                         |
| `java-static `[MediaRouteSelector](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteSelector)`?`                                                                                                                                                         | [fromBundle](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteSelector#fromBundle(android.os.Bundle))`(bundle: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?)` Creates an instance from a bundle.                                                                                                                                                                                                                                                                                                                           |
| `(`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!>` | [getControlCategories](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteSelector#getControlCategories())`()` Gets the list of[media control categories](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent)in the selector.                                                                                                                                                                                                                                                                                     |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                                                                                                                                         | [hasControlCategory](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteSelector#hasControlCategory(java.lang.String))`(category: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?)` Returns true if the selector contains the specified category.                                                                                                                                                                                                                                                                      |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                                                                                                                                                 | [hashCode](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteSelector#hashCode())`()`                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                                                                                                                                         | [isEmpty](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteSelector#isEmpty())`()` Returns true if the selector does not specify any capabilities.                                                                                                                                                                                                                                                                                                                                                                                                        |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                                                                                                                                         | [isValid](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteSelector#isValid())`()` Returns true if the selector has all of the required fields.                                                                                                                                                                                                                                                                                                                                                                                                           |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                                                                                                                                         | [matchesControlFilters](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteSelector#matchesControlFilters(java.util.List<android.content.IntentFilter>))`(filters: (`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[IntentFilter](https://developer.android.com/reference/android/content/IntentFilter.html)`!>?)` Returns true if the selector matches at least one of the specified control filters. |
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)                                                                                                                                                                                                           | [toString](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteSelector#toString())`()`                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |

## Constants

### EMPTY

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
const val EMPTY: MediaRouteSelector!
```

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

## Public functions

### asBundle

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
fun asBundle(): Bundle
```

Converts this object to a bundle for serialization.  

|                                 Returns                                  |
|--------------------------------------------------------------------------|-----------------------------------------------------|
| [Bundle](https://developer.android.com/reference/android/os/Bundle.html) | The contents of the object represented as a bundle. |

### contains

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
fun contains(selector: MediaRouteSelector): Boolean
```

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

|                                                           Parameters                                                           |
|--------------------------------------------------------------------------------------------------------------------------------|------------------------------|
| `selector: `[MediaRouteSelector](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteSelector) | The selector to be examined. |

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | True if this selector contains all of the capabilities described by the specified selector. |

### equals

```
fun equals(o: Any!): Boolean
```  

### fromBundle

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
java-static fun fromBundle(bundle: Bundle?): MediaRouteSelector?
```

Creates an instance from a bundle.  

|                                      Parameters                                       |
|---------------------------------------------------------------------------------------|------------------------------|
| `bundle: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?` | The bundle, or null if none. |

|                                                        Returns                                                        |
|-----------------------------------------------------------------------------------------------------------------------|---------------------------------------------------|
| [MediaRouteSelector](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouteSelector)`?` | The new instance, or null if the bundle was null. |

### getControlCategories

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
fun getControlCategories(): (Mutable)List<String!>
```

Gets the list of[media control categories](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent)in the selector.  

|                                                                                                                                           Returns                                                                                                                                           |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------|
| `(`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!>` | The list of categories. |

### hasControlCategory

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
fun hasControlCategory(category: String?): Boolean
```

Returns true if the selector contains the specified category.  

|                                            Parameters                                            |
|--------------------------------------------------------------------------------------------------|------------------------|
| `category: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?` | The category to check. |

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|-----------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | `true`if the category is present. |

### hashCode

```
fun hashCode(): Int
```  

### isEmpty

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
fun isEmpty(): Boolean
```

Returns true if the selector does not specify any capabilities.  

### isValid

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
fun isValid(): Boolean
```

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

### matchesControlFilters

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/mediarouter#1.1.0)  

```
fun matchesControlFilters(filters: (Mutable)List<IntentFilter!>?): Boolean
```

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

|                                                                                                                                                  Parameters                                                                                                                                                   |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------|
| `filters: (`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[IntentFilter](https://developer.android.com/reference/android/content/IntentFilter.html)`!>?` | The list of control filters to consider. |

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|---------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | True if a match is found. |

### toString

```
fun toString(): String
```