# OnSelectedDelegate

# OnSelectedDelegate

Artifact:[androidx.car.app:app](https://developer.android.com/jetpack/androidx/releases/car-app)  
[View Source](https://cs.android.com/search?q=file:androidx/car/app/model/OnSelectedDelegate.java+class:androidx.car.app.model.OnSelectedDelegate)  
Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/car/app/model/OnSelectedDelegate "View this page in Java")

<br />

```
@CarProtocol
interface OnSelectedDelegate
```

<br />

*** ** * ** ***

A host-side delegate for sending[androidx.car.app.model.ItemList.OnSelectedListener](https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList.OnSelectedListener)events to the car app.

## Summary

|                             ### Public functions                              |
|-------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [sendSelected](https://developer.android.com/reference/kotlin/androidx/car/app/model/OnSelectedDelegate#sendSelected(int,androidx.car.app.OnDoneCallback))`(selectedIndex: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, callback: `[OnDoneCallback](https://developer.android.com/reference/kotlin/androidx/car/app/OnDoneCallback)`)` Notifies that an item was selected. |

## Public functions

### sendSelected

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)  

```
fun sendSelected(selectedIndex: Int, callback: OnDoneCallback): Unit
```

Notifies that an item was selected.

This event is called even if the selection did not change, for example, if the user selected an already selected item.  

|                                                  Parameters                                                  |
|--------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|
| `selectedIndex: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                 | the index of the selected item                                                                                                                            |
| `callback: `[OnDoneCallback](https://developer.android.com/reference/kotlin/androidx/car/app/OnDoneCallback) | the[OnDoneCallback](https://developer.android.com/reference/kotlin/androidx/car/app/OnDoneCallback)to trigger when the client finishes handling the event |