# RouteListingPreference

# RouteListingPreference

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

*** ** * ** ***

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

<br />

```
class RouteListingPreference
```

<br />

*** ** * ** ***

Allows applications to customize the list of routes used for media routing (for example, in the System UI Output Switcher).  

|                                                                                            See also                                                                                             |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [setRouteListingPreference](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaRouter#setRouteListingPreference(androidx.mediarouter.media.RouteListingPreference)) |   |
| [RouteListingPreference.Item](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference.Item)                                                            |   |

## Summary

|                                                                                                                                                        ### Nested types                                                                                                                                                        |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `class `[RouteListingPreference.Builder](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference.Builder) Builder for[RouteListingPreference](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference).                                      |
| `class `[RouteListingPreference.Item](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference.Item) Holds preference information for a specific route in a[RouteListingPreference](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference). |
| `class `[RouteListingPreference.Item.Builder](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference.Item.Builder) Builder for[RouteListingPreference.Item](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference.Item).                  |

|                                        ### Constants                                         |
|----------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `const `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!` | [ACTION_TRANSFER_MEDIA](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference#ACTION_TRANSFER_MEDIA())` = "android.media.action.TRANSFER_MEDIA"` [Intent](https://developer.android.com/reference/android/content/Intent.html)action that the system uses to take the user the app when the user selects an[RouteListingPreference.Item](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference.Item)whose[selection behavior](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference.Item#getSelectionBehavior())is[SELECTION_BEHAVIOR_GO_TO_APP](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference.Item#SELECTION_BEHAVIOR_GO_TO_APP()). |
| `const `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!` | [EXTRA_ROUTE_ID](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference#EXTRA_ROUTE_ID())` = "android.media.extra.ROUTE_ID"` [Intent](https://developer.android.com/reference/android/content/Intent.html)string extra key that contains the[id](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference.Item#getRouteId())of the route to transfer to, as part of an[ACTION_TRANSFER_MEDIA](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference#ACTION_TRANSFER_MEDIA())intent.                                                                                                                                                                                                         |

|                                                                                                                                                              ### Public functions                                                                                                                                                              |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                                                                                                                                                                                            | [equals](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference#equals(java.lang.Object))`(other: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`!)`                                                                                                                                                                                                                                                       |
| `(`[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)`<`[RouteListingPreference.Item](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference.Item)`!>` | [getItems](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference#getItems())`()` Returns an unmodifiable list containing the[items](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference.Item)that the app wants to be listed for media routing.                                                                                                                                            |
| [ComponentName](https://developer.android.com/reference/android/content/ComponentName.html)`?`                                                                                                                                                                                                                                                 | [getLinkedItemComponentName](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference#getLinkedItemComponentName())`()` Returns a[ComponentName](https://developer.android.com/reference/android/content/ComponentName.html)for navigating to the application.                                                                                                                                                                             |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                                                                                                                                                                                                    | [hashCode](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference#hashCode())`()`                                                                                                                                                                                                                                                                                                                                                        |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                                                                                                                                                                                            | [isSystemOrderingEnabled](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference#isSystemOrderingEnabled())`()` Returns true if the application would like media route listing to use the system's ordering strategy, or false if the application would like route listing to respect the ordering obtained from[getItems](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference#getItems()). |

## Constants

### ACTION_TRANSFER_MEDIA

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

```
const val ACTION_TRANSFER_MEDIA = "android.media.action.TRANSFER_MEDIA": String!
```

[Intent](https://developer.android.com/reference/android/content/Intent.html)action that the system uses to take the user the app when the user selects an[RouteListingPreference.Item](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference.Item)whose[selection behavior](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference.Item#getSelectionBehavior())is[SELECTION_BEHAVIOR_GO_TO_APP](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference.Item#SELECTION_BEHAVIOR_GO_TO_APP()).

The launched intent will identify the selected item using the extra identified by[EXTRA_ROUTE_ID](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference#EXTRA_ROUTE_ID()).  

|                                                                               See also                                                                               |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [getLinkedItemComponentName](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference#getLinkedItemComponentName())          |   |
| [SELECTION_BEHAVIOR_GO_TO_APP](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference.Item#SELECTION_BEHAVIOR_GO_TO_APP()) |   |

### EXTRA_ROUTE_ID

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

```
const val EXTRA_ROUTE_ID = "android.media.extra.ROUTE_ID": String!
```

[Intent](https://developer.android.com/reference/android/content/Intent.html)string extra key that contains the[id](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference.Item#getRouteId())of the route to transfer to, as part of an[ACTION_TRANSFER_MEDIA](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference#ACTION_TRANSFER_MEDIA())intent.  

|                                                                               See also                                                                               |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [getLinkedItemComponentName](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference#getLinkedItemComponentName())          |   |
| [SELECTION_BEHAVIOR_GO_TO_APP](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference.Item#SELECTION_BEHAVIOR_GO_TO_APP()) |   |

## Public functions

### equals

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

### getItems

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

```
fun getItems(): (Mutable)List<RouteListingPreference.Item!>
```

Returns an unmodifiable list containing the[items](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference.Item)that the app wants to be listed for media routing.  

### getLinkedItemComponentName

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

```
fun getLinkedItemComponentName(): ComponentName?
```

Returns a[ComponentName](https://developer.android.com/reference/android/content/ComponentName.html)for navigating to the application.

Must not be null if any of the[items](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference#getItems())of this route listing preference has[selection behavior](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference.Item#getSelectionBehavior())[SELECTION_BEHAVIOR_GO_TO_APP](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference.Item#SELECTION_BEHAVIOR_GO_TO_APP()).

The system navigates to the application when the user selects[RouteListingPreference.Item](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference.Item)with[SELECTION_BEHAVIOR_GO_TO_APP](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference.Item#SELECTION_BEHAVIOR_GO_TO_APP())by launching an intent to the returned[ComponentName](https://developer.android.com/reference/android/content/ComponentName.html), using action[ACTION_TRANSFER_MEDIA](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference#ACTION_TRANSFER_MEDIA()), with the extra[EXTRA_ROUTE_ID](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference#EXTRA_ROUTE_ID()).  

### hashCode

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

### isSystemOrderingEnabled

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

```
fun isSystemOrderingEnabled(): Boolean
```

Returns true if the application would like media route listing to use the system's ordering strategy, or false if the application would like route listing to respect the ordering obtained from[getItems](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RouteListingPreference#getItems()).

The system's ordering strategy is implementation-dependent, but may take into account each route's recency or frequency of use in order to rank them.