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

*** ** * ** ***


```
public class SupportSQLiteOpenHelper.Configuration.Builder
```

<br />

*** ** * ** ***

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

## Summary

| ### Public methods |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/sqlite/db/SupportSQLiteOpenHelper.Configuration.Builder` | `https://developer.android.com/reference/androidx/sqlite/db/SupportSQLiteOpenHelper.Configuration.Builder#allowDataLossOnRecovery(kotlin.Boolean)(boolean allowDataLossOnRecovery)` 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. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/sqlite/db/SupportSQLiteOpenHelper.Configuration` | `https://developer.android.com/reference/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/androidx/sqlite/db/SupportSQLiteOpenHelper.Callback` is `null`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/sqlite/db/SupportSQLiteOpenHelper.Configuration.Builder` | `https://developer.android.com/reference/androidx/sqlite/db/SupportSQLiteOpenHelper.Configuration.Builder#callback(androidx.sqlite.db.SupportSQLiteOpenHelper.Callback)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/sqlite/db/SupportSQLiteOpenHelper.Callback callback)` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/sqlite/db/SupportSQLiteOpenHelper.Configuration.Builder` | `https://developer.android.com/reference/androidx/sqlite/db/SupportSQLiteOpenHelper.Configuration.Builder#name(kotlin.String)(https://developer.android.com/reference/java/lang/String.html name)` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/sqlite/db/SupportSQLiteOpenHelper.Configuration.Builder` | `https://developer.android.com/reference/androidx/sqlite/db/SupportSQLiteOpenHelper.Configuration.Builder#noBackupDirectory(kotlin.Boolean)(boolean useNoBackupDirectory)` Sets whether to use a no backup directory or not. |

## Public methods

### allowDataLossOnRecovery

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

```
public @NonNull SupportSQLiteOpenHelper.Configuration.Builder allowDataLossOnRecovery(boolean allowDataLossOnRecovery)
```

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 |
|---|---|
| `boolean allowDataLossOnRecovery` | If `true` the database file might be recreated in the case that it cannot be opened. |

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

### build

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

```
public @NonNull SupportSQLiteOpenHelper.Configuration build()
```

Throws an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` if the `https://developer.android.com/reference/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/androidx/annotation/NonNull https://developer.android.com/reference/androidx/sqlite/db/SupportSQLiteOpenHelper.Configuration` | The `https://developer.android.com/reference/androidx/sqlite/db/SupportSQLiteOpenHelper.Configuration` instance |

### callback

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

```
public @NonNull SupportSQLiteOpenHelper.Configuration.Builder callback(@NonNull SupportSQLiteOpenHelper.Callback callback)
```

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

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/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)

```
public @NonNull SupportSQLiteOpenHelper.Configuration.Builder name(String name)
```

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html name` | Name of the database file, or null for an in-memory database. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/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)

```
public @NonNull SupportSQLiteOpenHelper.Configuration.Builder noBackupDirectory(boolean useNoBackupDirectory)
```

Sets whether to use a no backup directory or not.

| Parameters |
|---|---|
| `boolean useNoBackupDirectory` | If `true` the database file will be stored in the no-backup directory. |

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