Skip to content

Most visited

Recently visited

navigation

ContentProviderOperation.Builder

public static class ContentProviderOperation.Builder
extends Object

java.lang.Object
   ↳ android.content.ContentProviderOperation.Builder


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

Summary

Public methods

ContentProviderOperation build()

Create a ContentProviderOperation from this ContentProviderOperation.Builder.

ContentProviderOperation.Builder withExpectedCount(int count)

If set then if the number of rows affected by this operation does not match this count OperationApplicationException will be throw.

ContentProviderOperation.Builder withSelection(String selection, String[] selectionArgs)

The selection and arguments to use.

ContentProviderOperation.Builder withSelectionBackReference(int selectionArgIndex, int previousResult)

Add a back references as a selection arg.

ContentProviderOperation.Builder withValue(String key, Object value)

A value to insert or update.

ContentProviderOperation.Builder withValueBackReference(String key, int previousResult)

Add a ContentValues back reference.

ContentProviderOperation.Builder withValueBackReferences(ContentValues backReferences)

Add a ContentValues of back references.

ContentProviderOperation.Builder withValues(ContentValues values)

The ContentValues to use.

ContentProviderOperation.Builder withYieldAllowed(boolean yieldAllowed)

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

Inherited methods

From class java.lang.Object

Public methods

build

Added in API level 5
ContentProviderOperation build ()

Create a ContentProviderOperation from this ContentProviderOperation.Builder.

Returns
ContentProviderOperation

withExpectedCount

Added in API level 5
ContentProviderOperation.Builder withExpectedCount (int count)

If set then if the number of rows affected by this operation does not match this count OperationApplicationException will be throw. This can only be used with builders of type update, delete, or assert.

Parameters
count int
Returns
ContentProviderOperation.Builder this builder, to allow for chaining.

withSelection

Added in API level 5
ContentProviderOperation.Builder withSelection (String selection, 
                String[] selectionArgs)

The selection and arguments to use. An occurrence of '?' in the selection will be replaced with the corresponding occurence of the selection argument. Any of the selection arguments may be overwritten by a selection argument back reference as specified by withSelectionBackReference(int, int). This can only be used with builders of type update, delete, or assert.

Parameters
selection String
selectionArgs String
Returns
ContentProviderOperation.Builder this builder, to allow for chaining.

withSelectionBackReference

Added in API level 5
ContentProviderOperation.Builder withSelectionBackReference (int selectionArgIndex, 
                int previousResult)

Add a back references as a selection arg. Any value at that index of the selection arg that was specified by withSelection(String, String[]) will be overwritten. This can only be used with builders of type update, delete, or assert.

Parameters
selectionArgIndex int
previousResult int
Returns
ContentProviderOperation.Builder this builder, to allow for chaining.

withValue

Added in API level 5
ContentProviderOperation.Builder withValue (String key, 
                Object value)

A value to insert or update. This value may be overwritten by the corresponding value specified by withValueBackReference(String, int). This can only be used with builders of type insert, update, or assert.

Parameters
key String: the name of this value
value Object: the value itself. the type must be acceptable for insertion by put(String, byte[])
Returns
ContentProviderOperation.Builder this builder, to allow for chaining.

withValueBackReference

Added in API level 5
ContentProviderOperation.Builder withValueBackReference (String key, 
                int previousResult)

Add a ContentValues back reference. A column value from the back references takes precedence over a value specified in withValues(ContentValues). This can only be used with builders of type insert, update, or assert.

Parameters
key String
previousResult int
Returns
ContentProviderOperation.Builder this builder, to allow for chaining.

withValueBackReferences

Added in API level 5
ContentProviderOperation.Builder withValueBackReferences (ContentValues backReferences)

Add a ContentValues of back references. The key is the name of the column and the value is an integer that is the index of the previous result whose value should be used for the column. The value is added as a String. A column value from the back references takes precedence over a value specified in withValues(ContentValues). This can only be used with builders of type insert, update, or assert.

Parameters
backReferences ContentValues
Returns
ContentProviderOperation.Builder this builder, to allow for chaining.

withValues

Added in API level 5
ContentProviderOperation.Builder withValues (ContentValues values)

The ContentValues to use. This may be null. These values may be overwritten by the corresponding value specified by withValueBackReference(String, int) or by future calls to withValues(ContentValues) or withValue(String, Object). This can only be used with builders of type insert, update, or assert.

Parameters
values ContentValues
Returns
ContentProviderOperation.Builder this builder, to allow for chaining.

withYieldAllowed

Added in API level 5
ContentProviderOperation.Builder withYieldAllowed (boolean yieldAllowed)

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

Parameters
yieldAllowed boolean
Returns
ContentProviderOperation.Builder this builder, to allow for chaining.

See also:

This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.