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

*** ** * ** ***


```
public interface SearchTemplate.SearchCallback
```

<br />

*** ** * ** ***

A listener for search updates.

## Summary

| ### Public methods |
|---|---|
| `default void` | `https://developer.android.com/reference/androidx/car/app/model/SearchTemplate.SearchCallback#onSearchSubmitted(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html searchText)` Notifies that the user has submitted the search and the given `searchText` is the final term. |
| `default void` | `https://developer.android.com/reference/androidx/car/app/model/SearchTemplate.SearchCallback#onSearchTextChanged(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html searchText)` Notifies the current `searchText` has changed. |

## Public methods

### onSearchSubmitted

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

```
default void onSearchSubmitted(@NonNull String searchText)
```

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

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html searchText` | 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)

```
default void onSearchTextChanged(@NonNull String searchText)
```

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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html searchText` | the current search text that the user has typed |