# SearchTemplate

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) 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 "View this page in Java")


```
@CarProtocol
class SearchTemplate : Template
```

<br />

*** ** * ** ***

A model that allows the user to enter text searches, and can display results in a list.

#### Template Restrictions

In regards to template refreshes, as described in `https://developer.android.com/reference/kotlin/androidx/car/app/Screen#onGetTemplate()`, this template supports any content changes as refreshes. This allows apps to interactively update the search results as the user types without the templates being counted against the quota.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchTemplate.Builder` A builder of `https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchTemplate`. |
| `interface https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchTemplate.SearchCallback` A listener for search updates. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchTemplate#equals(java.lang.Object)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/ActionStrip?` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchTemplate#getActionStrip()()` Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/ActionStrip` for this template or `null` if not set. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action?` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchTemplate#getHeaderAction()()` Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action` that is set to be displayed in the header of the template, or `null` if not set. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchTemplate#getInitialSearchText()()` Returns the optional initial search text. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList?` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchTemplate#getItemList()()` Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList` for search results or `null` if not set. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchCallbackDelegate` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchTemplate#getSearchCallbackDelegate()()` Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchCallbackDelegate` for search callbacks. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchTemplate#getSearchHint()()` Returns the optional search hint. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchTemplate#hashCode()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchTemplate#isLoading()()` Returns whether the template is loading. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchTemplate#isShowKeyboardByDefault()()` Returns whether to show the keyboard by default. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchTemplate#toString()()` |

## Public functions

### equals

```
fun equals(other: Any?): Boolean
```

### getActionStrip

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

```
fun getActionStrip(): ActionStrip?
```

Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/ActionStrip` for this template or `null` if not set.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchTemplate.Builder#setActionStrip(androidx.car.app.model.ActionStrip)` |   |

### getHeaderAction

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

```
fun getHeaderAction(): Action?
```

Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action` that is set to be displayed in the header of the template, or `null` if not set.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchTemplate.Builder#setHeaderAction(androidx.car.app.model.Action)` |   |

### getInitialSearchText

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

```
fun getInitialSearchText(): String?
```

Returns the optional initial search text.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchTemplate.Builder#setInitialSearchText(java.lang.String)` |   |

### getItemList

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

```
fun getItemList(): ItemList?
```

Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList` for search results or `null` if not set.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchTemplate#getItemList()` |   |

### getSearchCallbackDelegate

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

```
fun getSearchCallbackDelegate(): SearchCallbackDelegate
```

Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchCallbackDelegate` for search callbacks.

### getSearchHint

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

```
fun getSearchHint(): String?
```

Returns the optional search hint.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchTemplate.Builder#setSearchHint(java.lang.String)` |   |

### hashCode

```
fun hashCode(): Int
```

### isLoading

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

```
fun isLoading(): Boolean
```

Returns whether the template is loading.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchTemplate.Builder#setLoading(boolean)` |   |

### isShowKeyboardByDefault

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

```
fun isShowKeyboardByDefault(): Boolean
```

Returns whether to show the keyboard by default.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/SearchTemplate.Builder#setShowKeyboardByDefault(boolean)` |   |

### toString

```
fun toString(): String
```