# SearchCallback

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/SearchCallback.java+class:androidx.car.app.model.SearchCallback) Added in [1.9.0-alpha03](https://developer.android.com/jetpack/androidx/releases/car-app#1.9.0-alpha03)

*** ** * ** ***


```
interface SearchCallback
```

<br />

Known direct subclasses [SearchTemplate.SearchCallback](https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchTemplate.SearchCallback)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchTemplate.SearchCallback` | A listener for search updates. |

*** ** * ** ***

A listener used in a `https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchHeader` and a `https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchTemplate` to receive the search text updates from a user.

## Summary

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchCallback#onSearchSubmitted(java.lang.String)(searchText: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Notifies that the user has submitted the search and the given `searchText` is the final term. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchCallback#onSearchTextChanged(java.lang.String)(searchText: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Notifies that the current `searchText` has changed. |

## Public functions

### onSearchSubmitted

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

```
fun onSearchSubmitted(searchText: String): Unit
```

Notifies that the user has submitted the search and the given `searchText` is the final term.

| Parameters |
|---|---|
| `searchText: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the search text that the user typed |

### onSearchTextChanged

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

```
fun onSearchTextChanged(searchText: String): Unit
```

Notifies that the current `searchText` has changed.

The host may invoke this callback as the user types a search text. The frequency of these updates is not guaranteed to be after every individual keystroke. The host may decide to wait for several keystrokes before sending a single update.

| Parameters |
|---|---|
| `searchText: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the current search text that the user has typed |