# ContentProviderOperation.Builder

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

# Builder

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/content/ContentProviderOperation.Builder "View this page in Java")  

```
open class Builder
```

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

Used to add parameters to a[ContentProviderOperation](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation). The[Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#)is first created by calling[ContentProviderOperation.newInsert(android.net.Uri)](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation#newInsert(android.net.Uri)),[ContentProviderOperation.newUpdate(android.net.Uri)](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation#newUpdate(android.net.Uri)),[ContentProviderOperation.newDelete(android.net.Uri)](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation#newDelete(android.net.Uri))or[ContentProviderOperation.newAssertQuery(Uri)](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation#newAssertQuery(android.net.Uri)). The withXXX methods can then be used to add parameters to the builder. See the specific methods to find for which[Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#)type each is allowed. Call[build](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#build())to create the[ContentProviderOperation](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation)once all the parameters have been supplied.

## Summary

|                                                                                                                                                                                                                                                                                                                                                                 Public methods                                                                                                                                                                                                                                                                                                                                                                  ||
|------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[ContentProviderOperation](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation)                  | [build](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#build())`()` Create a ContentProviderOperation from this[Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#).                                                                                                                                                                                                                                                                                                                          |
| open[ContentProviderOperation.Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#) | [withExceptionAllowed](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#withExceptionAllowed(kotlin.Boolean))`(`exceptionAllowed:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` If set to true, this operation allows subsequent operations to continue even if this operation throws an exception.                                                                                                                                                                                                          |
| open[ContentProviderOperation.Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#) | [withExpectedCount](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#withExpectedCount(kotlin.Int))`(`count:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` If set then if the number of rows affected by this operation does not match this count[OperationApplicationException](https://developer.android.com/reference/kotlin/android/content/OperationApplicationException)will be throw.                                                                                                                         |
| open[ContentProviderOperation.Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#) | [withExtra](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#withExtra(kotlin.String,%20kotlin.Any))`(`key:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `value:` `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?`)` Configure the given extra to use for this operation.                                                                                                                                                                                                         |
| open[ContentProviderOperation.Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#) | [withExtraBackReference](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#withExtraBackReference(kotlin.String,%20kotlin.Int))`(`key:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `fromIndex:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Configure the given extra to be dynamically overwritten using the result of a previous operation.                                                                                                                               |
| open[ContentProviderOperation.Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#) | [withExtraBackReference](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#withExtraBackReference(kotlin.String,%20kotlin.Int,%20kotlin.String))`(`key:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `fromIndex:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `fromKey:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Configure the given extra to be dynamically overwritten using the result of a previous operation.               |
| open[ContentProviderOperation.Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#) | [withExtras](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#withExtras(android.os.Bundle))`(`extras:` `[Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)`)` Configure the extras to use for this operation.                                                                                                                                                                                                                                                                                                           |
| open[ContentProviderOperation.Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#) | [withSelection](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#withSelection(kotlin.String,%20kotlin.Array))`(`selection:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?`, `selectionArgs:` `[Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!>?`)` Configure the selection and selection arguments to use for this operation.                                                                   |
| open[ContentProviderOperation.Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#) | [withSelectionBackReference](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#withSelectionBackReference(kotlin.Int,%20kotlin.Int))`(`index:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `fromIndex:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Configure the given selection argument to be dynamically overwritten using the result of a previous operation.                                                                                                                 |
| open[ContentProviderOperation.Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#) | [withSelectionBackReference](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#withSelectionBackReference(kotlin.Int,%20kotlin.Int,%20kotlin.String))`(`index:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `fromIndex:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `fromKey:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Configure the given selection argument to be dynamically overwritten using the result of a previous operation. |
| open[ContentProviderOperation.Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#) | [withValue](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#withValue(kotlin.String,%20kotlin.Any))`(`key:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `value:` `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?`)` Configure the given value to use for this operation.                                                                                                                                                                                                         |
| open[ContentProviderOperation.Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#) | [withValueBackReference](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#withValueBackReference(kotlin.String,%20kotlin.Int))`(`key:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `fromIndex:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Configure the given value to be dynamically overwritten using the result of a previous operation.                                                                                                                               |
| open[ContentProviderOperation.Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#) | [withValueBackReference](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#withValueBackReference(kotlin.String,%20kotlin.Int,%20kotlin.String))`(`key:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `fromIndex:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `fromKey:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Configure the given value to be dynamically overwritten using the result of a previous operation.               |
| open[ContentProviderOperation.Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#) | [withValueBackReferences](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#withValueBackReferences(android.content.ContentValues))`(`backReferences:` `[ContentValues](https://developer.android.com/reference/kotlin/android/content/ContentValues)`)` Configure the given values to be dynamically overwritten using the result of a previous operation.                                                                                                                                                                                             |
| open[ContentProviderOperation.Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#) | [withValues](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#withValues(android.content.ContentValues))`(`values:` `[ContentValues](https://developer.android.com/reference/kotlin/android/content/ContentValues)`)` Configure the values to use for this operation.                                                                                                                                                                                                                                                                                  |
| open[ContentProviderOperation.Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#) | [withYieldAllowed](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#withYieldAllowed(kotlin.Boolean))`(`yieldAllowed:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` If set to true then the operation allows yielding the database to other transactions if the database is contended.                                                                                                                                                                                                                       |

## Public methods

### build

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

```
open fun build(): ContentProviderOperation
```

Create a ContentProviderOperation from this[Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#).

|                                                                      Return                                                                      ||
|---------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ContentProviderOperation](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation) | This value cannot be`null`. |

### withExceptionAllowed

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

```
open fun withExceptionAllowed(exceptionAllowed: Boolean): ContentProviderOperation.Builder
```

If set to true, this operation allows subsequent operations to continue even if this operation throws an exception. When true, any encountered exception is returned via[ContentProviderResult.exception](https://developer.android.com/reference/kotlin/android/content/ContentProviderResult#exception:kotlin.Throwable).

|                                                                              Return                                                                               ||
|--------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ContentProviderOperation.Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#) | This value cannot be`null`. |

### withExpectedCount

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

```
open fun withExpectedCount(count: Int): ContentProviderOperation.Builder
```

If set then if the number of rows affected by this operation does not match this count[OperationApplicationException](https://developer.android.com/reference/kotlin/android/content/OperationApplicationException)will be throw. This can only be used with builders of type update, delete, or assert.

|                                                                                                 Return                                                                                                 ||
|--------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------|
| [ContentProviderOperation.Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#) | this builder, to allow for chaining. This value cannot be`null`. |

### withExtra

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

```
open fun withExtra(
    key: String, 
    value: Any?
): ContentProviderOperation.Builder
```

Configure the given extra to use for this operation. This method will replace any previously defined extras for this key.

|                                                                            Parameters                                                                             ||
|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
| `key`   | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):the key indicating which extra to configure This value cannot be`null`. |
| `value` | [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?:This value may be`null`.                                                     |

|                                                                              Return                                                                               ||
|--------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ContentProviderOperation.Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#) | This value cannot be`null`. |

### withExtraBackReference

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

```
open fun withExtraBackReference(
    key: String, 
    fromIndex: Int
): ContentProviderOperation.Builder
```

Configure the given extra to be dynamically overwritten using the result of a previous operation. This method will replace any previously defined extras for this key.

|                                                                                                                              Parameters                                                                                                                              ||
|-------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `key`       | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):the key indicating which extra to configure This value cannot be`null`.                                                                                                |
| `fromIndex` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the index indicating which historical[ContentProviderResult](https://developer.android.com/reference/kotlin/android/content/ContentProviderResult)should overwrite the extra |

|                                                                              Return                                                                               ||
|--------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ContentProviderOperation.Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#) | This value cannot be`null`. |

### withExtraBackReference

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

```
open fun withExtraBackReference(
    key: String, 
    fromIndex: Int, 
    fromKey: String
): ContentProviderOperation.Builder
```

Configure the given extra to be dynamically overwritten using the result of a previous operation. This method will replace any previously defined extras for this key.

|                                                                                                                                                             Parameters                                                                                                                                                             ||
|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `key`       | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):the key indicating which extra to configure This value cannot be`null`.                                                                                                                                                              |
| `fromIndex` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the index indicating which historical[ContentProviderResult](https://developer.android.com/reference/kotlin/android/content/ContentProviderResult)should overwrite the extra                                                               |
| `fromKey`   | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):the key of indicating which[ContentProviderResult.extras](https://developer.android.com/reference/kotlin/android/content/ContentProviderResult#extras:android.os.Bundle)value should overwrite the extra This value cannot be`null`. |

|                                                                              Return                                                                               ||
|--------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ContentProviderOperation.Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#) | This value cannot be`null`. |

### withExtras

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

```
open fun withExtras(extras: Bundle): ContentProviderOperation.Builder
```

Configure the extras to use for this operation. This method will replace any previously defined values for the contained keys, but it will not replace any back-reference requests.

Any value may be dynamically overwritten using the result of a previous operation by using methods such as[withExtraBackReference(java.lang.String,int)](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#withExtraBackReference(kotlin.String,%20kotlin.Int)).

|                                                       Parameters                                                       ||
|----------|--------------------------------------------------------------------------------------------------------------|
| `extras` | [Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#):This value cannot be`null`. |

|                                                                              Return                                                                               ||
|--------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ContentProviderOperation.Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#) | This value cannot be`null`. |

### withSelection

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

```
open fun withSelection(
    selection: String?, 
    selectionArgs: Array<String!>?
): ContentProviderOperation.Builder
```

Configure the selection and selection arguments to use for this operation. This method will replace any previously defined selection and selection arguments, but it will not replace any back-reference requests.

An occurrence of`?`in the selection will be replaced with the corresponding selection argument when the operation is executed.

Any selection argument may be dynamically overwritten using the result of a previous operation by using methods such as[withSelectionBackReference(int,int)](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#withSelectionBackReference(kotlin.Int,%20kotlin.Int)).

|                                                                                                   Parameters                                                                                                   ||
|-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `selection`     | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?:This value may be`null`.                                                                                    |
| `selectionArgs` | [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>?:This value may be`null`. |

|                                                                              Return                                                                               ||
|--------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ContentProviderOperation.Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#) | This value cannot be`null`. |

### withSelectionBackReference

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

```
open fun withSelectionBackReference(
    index: Int, 
    fromIndex: Int
): ContentProviderOperation.Builder
```

Configure the given selection argument to be dynamically overwritten using the result of a previous operation. This method will replace any previously defined selection argument at this index.

|                                                                                                                                    Parameters                                                                                                                                     ||
|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `index`     | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the index indicating which selection argument to configure                                                                                                                                |
| `fromIndex` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the index indicating which historical[ContentProviderResult](https://developer.android.com/reference/kotlin/android/content/ContentProviderResult)should overwrite the selection argument |

|                                                                              Return                                                                               ||
|--------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ContentProviderOperation.Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#) | This value cannot be`null`. |

### withSelectionBackReference

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

```
open fun withSelectionBackReference(
    index: Int, 
    fromIndex: Int, 
    fromKey: String
): ContentProviderOperation.Builder
```

Configure the given selection argument to be dynamically overwritten using the result of a previous operation. This method will replace any previously defined selection argument at this index.

|                                                                                                                                                                   Parameters                                                                                                                                                                    ||
|-------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `index`     | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the index indicating which selection argument to configure                                                                                                                                                                                              |
| `fromIndex` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the index indicating which historical[ContentProviderResult](https://developer.android.com/reference/kotlin/android/content/ContentProviderResult)should overwrite the selection argument                                                               |
| `fromKey`   | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):the key of indicating which[ContentProviderResult.extras](https://developer.android.com/reference/kotlin/android/content/ContentProviderResult#extras:android.os.Bundle)value should overwrite the selection argument This value cannot be`null`. |

|                                                                              Return                                                                               ||
|--------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ContentProviderOperation.Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#) | This value cannot be`null`. |

### withValue

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

```
open fun withValue(
    key: String, 
    value: Any?
): ContentProviderOperation.Builder
```

Configure the given value to use for this operation. This method will replace any previously defined value for this key.

|                                                                            Parameters                                                                             ||
|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
| `key`   | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):the key indicating which value to configure This value cannot be`null`. |
| `value` | [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?:This value may be`null`.                                                     |

|                                                                              Return                                                                               ||
|--------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ContentProviderOperation.Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#) | This value cannot be`null`. |

### withValueBackReference

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

```
open fun withValueBackReference(
    key: String, 
    fromIndex: Int
): ContentProviderOperation.Builder
```

Configure the given value to be dynamically overwritten using the result of a previous operation. This method will replace any previously defined value for this key.

|                                                                                                                              Parameters                                                                                                                              ||
|-------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `key`       | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):the key indicating which value to configure This value cannot be`null`.                                                                                                |
| `fromIndex` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the index indicating which historical[ContentProviderResult](https://developer.android.com/reference/kotlin/android/content/ContentProviderResult)should overwrite the value |

|                                                                              Return                                                                               ||
|--------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ContentProviderOperation.Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#) | This value cannot be`null`. |

### withValueBackReference

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

```
open fun withValueBackReference(
    key: String, 
    fromIndex: Int, 
    fromKey: String
): ContentProviderOperation.Builder
```

Configure the given value to be dynamically overwritten using the result of a previous operation. This method will replace any previously defined value for this key.

|                                                                                                                                                             Parameters                                                                                                                                                             ||
|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `key`       | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):the key indicating which value to configure This value cannot be`null`.                                                                                                                                                              |
| `fromIndex` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the index indicating which historical[ContentProviderResult](https://developer.android.com/reference/kotlin/android/content/ContentProviderResult)should overwrite the value                                                               |
| `fromKey`   | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):the key of indicating which[ContentProviderResult.extras](https://developer.android.com/reference/kotlin/android/content/ContentProviderResult#extras:android.os.Bundle)value should overwrite the value This value cannot be`null`. |

|                                                                              Return                                                                               ||
|--------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ContentProviderOperation.Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#) | This value cannot be`null`. |

### withValueBackReferences

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

```
open fun withValueBackReferences(backReferences: ContentValues): ContentProviderOperation.Builder
```

Configure the given values to be dynamically overwritten using the result of a previous operation. This method will replace any previously defined values for these keys.

|                                                                                                                                                                                              Parameters                                                                                                                                                                                               ||
|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `backReferences` | [ContentValues](https://developer.android.com/reference/kotlin/android/content/ContentValues):set of values where the key indicates which value to configure and the value the index indicating which historical[ContentProviderResult](https://developer.android.com/reference/kotlin/android/content/ContentProviderResult)should overwrite the value This value cannot be`null`. |

|                                                                              Return                                                                               ||
|--------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ContentProviderOperation.Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#) | This value cannot be`null`. |

### withValues

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

```
open fun withValues(values: ContentValues): ContentProviderOperation.Builder
```

Configure the values to use for this operation. This method will replace any previously defined values for the contained keys, but it will not replace any back-reference requests.

Any value may be dynamically overwritten using the result of a previous operation by using methods such as[withValueBackReference(java.lang.String,int)](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#withValueBackReference(kotlin.String,%20kotlin.Int)).

|                                                             Parameters                                                              ||
|----------|---------------------------------------------------------------------------------------------------------------------------|
| `values` | [ContentValues](https://developer.android.com/reference/kotlin/android/content/ContentValues):This value cannot be`null`. |

|                                                                              Return                                                                               ||
|--------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ContentProviderOperation.Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#) | This value cannot be`null`. |

### withYieldAllowed

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

```
open fun withYieldAllowed(yieldAllowed: Boolean): ContentProviderOperation.Builder
```

If set to true then the operation allows yielding the database to other transactions if the database is contended.

|                                                                                                 Return                                                                                                 ||
|--------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------|
| [ContentProviderOperation.Builder](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.Builder#) | this builder, to allow for chaining. This value cannot be`null`. |

**See Also**

- [android.database.sqlite.SQLiteDatabase#yieldIfContendedSafely()](https://developer.android.com/reference/kotlin/android/database/sqlite/SQLiteDatabase.html#yieldIfContendedSafely())