# SupportSQLiteOpenHelper.Configuration.Builder

Artifact: [androidx.sqlite:sqlite](https://developer.android.com/jetpack/androidx/releases/sqlite) [View Source](https://cs.android.com/search?q=file:androidx/sqlite/db/SupportSQLiteOpenHelper.android.kt+class:androidx.sqlite.db.SupportSQLiteOpenHelper.Configuration.Builder) Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

*** ** * ** ***


```
open class SupportSQLiteOpenHelper.Configuration.Builder
```

<br />

*** ** * ** ***

Builder class for `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteOpenHelper.Configuration`.

## Summary

| ### Public functions |
|---|---|
| `open https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteOpenHelper.Configuration.Builder` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteOpenHelper.Configuration.Builder#allowDataLossOnRecovery(kotlin.Boolean)(allowDataLossOnRecovery: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Sets whether to delete and recreate the database file in situations when the database file cannot be opened, thus allowing for its data to be lost. |
| `open https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteOpenHelper.Configuration` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteOpenHelper.Configuration.Builder#build()()` Throws an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` if the `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteOpenHelper.Callback` is `null`. |
| `open https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteOpenHelper.Configuration.Builder` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteOpenHelper.Configuration.Builder#callback(androidx.sqlite.db.SupportSQLiteOpenHelper.Callback)(callback: https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteOpenHelper.Callback)` |
| `open https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteOpenHelper.Configuration.Builder` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteOpenHelper.Configuration.Builder#name(kotlin.String)(name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?)` |
| `open https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteOpenHelper.Configuration.Builder` | `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteOpenHelper.Configuration.Builder#noBackupDirectory(kotlin.Boolean)(useNoBackupDirectory: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Sets whether to use a no backup directory or not. |

## Public functions

### allowDataLossOnRecovery

Added in [2.3.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.3.0)

```
open fun allowDataLossOnRecovery(allowDataLossOnRecovery: Boolean): SupportSQLiteOpenHelper.Configuration.Builder
```

Sets whether to delete and recreate the database file in situations when the database file cannot be opened, thus allowing for its data to be lost.

| Parameters |
|---|---|
| `allowDataLossOnRecovery: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | If `true` the database file might be recreated in the case that it cannot be opened. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteOpenHelper.Configuration.Builder` | this |

### build

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
open fun build(): SupportSQLiteOpenHelper.Configuration
```

Throws an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` if the `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteOpenHelper.Callback` is `null`.

Throws an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` if the `https://developer.android.com/reference/android/content/Context.html` is `null`.

Throws an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` if the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` database name is `null`. `https://developer.android.com/reference/android/content/Context.html#getNoBackupFilesDir()`

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteOpenHelper.Configuration` | The `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteOpenHelper.Configuration` instance |

### callback

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
open fun callback(callback: SupportSQLiteOpenHelper.Callback): SupportSQLiteOpenHelper.Configuration.Builder
```

| Parameters |
|---|---|
| `callback: https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteOpenHelper.Callback` | The callback class to handle creation, upgrade and downgrade. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteOpenHelper.Configuration.Builder` | This builder instance. |

### name

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.0.0)

```
open fun name(name: String?): SupportSQLiteOpenHelper.Configuration.Builder
```

| Parameters |
|---|---|
| `name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | Name of the database file, or null for an in-memory database. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteOpenHelper.Configuration.Builder` | This builder instance. |

### noBackupDirectory

Added in [2.1.0](https://developer.android.com/jetpack/androidx/releases/sqlite#2.1.0)

```
open fun noBackupDirectory(useNoBackupDirectory: Boolean): SupportSQLiteOpenHelper.Configuration.Builder
```

Sets whether to use a no backup directory or not.

| Parameters |
|---|---|
| `useNoBackupDirectory: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | If `true` the database file will be stored in the no-backup directory. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/sqlite/db/SupportSQLiteOpenHelper.Configuration.Builder` | This builder instance. |