Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Builder

*** ** * ** ***

Kotlin \|[Java](https://developer.android.com/reference/android/app/appsearch/AppSearchManager.SearchContext.Builder "View this page in Java")

```
class Builder
```

|---|---|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||
| ↳ | [android.app.appsearch.AppSearchManager.SearchContext.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchManager.SearchContext.Builder#) |

Builder for `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchManager.SearchContext` objects.

## Summary

| Public constructors ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchManager.SearchContext.Builder#Builder(kotlin.String)(databaseName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Creates a new `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchManager.SearchContext.Builder#`. |

| Public methods ||
|---|---|
| [AppSearchManager.SearchContext](https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchManager.SearchContext) | `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchManager.SearchContext.Builder#build()()` Builds a `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchManager.SearchContext` instance. |

## Public constructors

### Builder

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
Builder(databaseName: String)
```

Creates a new `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchManager.SearchContext.Builder#`.

`https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSession` will create or open a database under the given name.

Databases with different names are fully separate with distinct types, namespaces, and data.

Database name cannot contain `'/'`.

| Parameters ||
|---|---|
| `databaseName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The name of the database. This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if the databaseName contains `'/'`. |

## Public methods

### build

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun build(): AppSearchManager.SearchContext
```

Builds a `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchManager.SearchContext` instance.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchManager.SearchContext` | This value cannot be `null`. |