# SearchTemplate.SearchCallback

# SearchTemplate.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/SearchTemplate.java+class:androidx.car.app.model.SearchTemplate.SearchCallback)  
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/SearchTemplate.SearchCallback "View this page in Java")

<br />

```
interface SearchTemplate.SearchCallback
```

<br />

*** ** * ** ***

A listener for search updates.

## Summary

|                             ### Public functions                              |
|-------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onSearchSubmitted](https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchTemplate.SearchCallback#onSearchSubmitted(java.lang.String))`(searchText: `[String](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. |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onSearchTextChanged](https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchTemplate.SearchCallback#onSearchTextChanged(java.lang.String))`(searchText: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`)` Notifies the current`searchText`has changed.                                            |

## Public functions

### onSearchSubmitted

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

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

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

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

### onSearchTextChanged

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

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

Notifies 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: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html) | the current search text that the user has typed |