# 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)

*** ** * ** ***


```
public final 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 |
|---|---|
| `https://developer.android.com/reference/androidx/mediarouter/media/MediaRouter#setRouteListingPreference(androidx.mediarouter.media.RouteListingPreference)` |   |
| `https://developer.android.com/reference/androidx/mediarouter/media/RouteListingPreference.Item` |   |

## Summary

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

| ### Constants |
|---|---|
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/mediarouter/media/RouteListingPreference#ACTION_TRANSFER_MEDIA() = "android.media.action.TRANSFER_MEDIA"` `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 `https://developer.android.com/reference/androidx/mediarouter/media/RouteListingPreference.Item` whose `https://developer.android.com/reference/androidx/mediarouter/media/RouteListingPreference.Item#getSelectionBehavior()` is `https://developer.android.com/reference/androidx/mediarouter/media/RouteListingPreference.Item#SELECTION_BEHAVIOR_GO_TO_APP()`. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/mediarouter/media/RouteListingPreference#EXTRA_ROUTE_ID() = "android.media.extra.ROUTE_ID"` `https://developer.android.com/reference/android/content/Intent.html` string extra key that contains the `https://developer.android.com/reference/androidx/mediarouter/media/RouteListingPreference.Item#getRouteId()` of the route to transfer to, as part of an `https://developer.android.com/reference/androidx/mediarouter/media/RouteListingPreference#ACTION_TRANSFER_MEDIA()` intent. |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/mediarouter/media/RouteListingPreference#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/mediarouter/media/RouteListingPreference.Item>` | `https://developer.android.com/reference/androidx/mediarouter/media/RouteListingPreference#getItems()()` Returns an unmodifiable list containing the `https://developer.android.com/reference/androidx/mediarouter/media/RouteListingPreference.Item` that the app wants to be listed for media routing. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/content/ComponentName.html` | `https://developer.android.com/reference/androidx/mediarouter/media/RouteListingPreference#getLinkedItemComponentName()()` Returns a `https://developer.android.com/reference/android/content/ComponentName.html` for navigating to the application. |
| `int` | `https://developer.android.com/reference/androidx/mediarouter/media/RouteListingPreference#hashCode()()` |
| `boolean` | `https://developer.android.com/reference/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 `https://developer.android.com/reference/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)

```
public static final String ACTION_TRANSFER_MEDIA = "android.media.action.TRANSFER_MEDIA"
```

`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 `https://developer.android.com/reference/androidx/mediarouter/media/RouteListingPreference.Item` whose `https://developer.android.com/reference/androidx/mediarouter/media/RouteListingPreference.Item#getSelectionBehavior()` is `https://developer.android.com/reference/androidx/mediarouter/media/RouteListingPreference.Item#SELECTION_BEHAVIOR_GO_TO_APP()`.

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

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/mediarouter/media/RouteListingPreference#getLinkedItemComponentName()` |   |
| `https://developer.android.com/reference/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)

```
public static final String EXTRA_ROUTE_ID = "android.media.extra.ROUTE_ID"
```

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

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

## Public methods

### equals

```
public boolean equals(Object other)
```

### getItems

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

```
public @NonNull List<RouteListingPreference.Item> getItems()
```

Returns an unmodifiable list containing the `https://developer.android.com/reference/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)

```
public @Nullable ComponentName getLinkedItemComponentName()
```

Returns a `https://developer.android.com/reference/android/content/ComponentName.html` for navigating to the application.

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

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

### hashCode

```
public int hashCode()
```

### isSystemOrderingEnabled

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

```
public boolean 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 `https://developer.android.com/reference/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.