Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Methods](https://developer.android.com/reference/android/content/ContentProviderClient#pubmethods) \| [Protected Methods](https://developer.android.com/reference/android/content/ContentProviderClient#promethods) \| [Inherited Methods](https://developer.android.com/reference/android/content/ContentProviderClient#inhmethods)

# ContentProviderClient

*** ** * ** ***

` public class ContentProviderClient `   
` extends https://developer.android.com/reference/java/lang/Object ` ` implements https://developer.android.com/reference/java/lang/AutoCloseable `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.content.ContentProviderClient |

<br />

*** ** * ** ***

The public interface object used to interact with a specific `https://developer.android.com/reference/android/content/ContentProvider`.

Instances can be obtained by calling `https://developer.android.com/reference/android/content/ContentResolver#acquireContentProviderClient(android.net.Uri)` or `https://developer.android.com/reference/android/content/ContentResolver#acquireUnstableContentProviderClient(android.net.Uri)`. Instances must be released using `https://developer.android.com/reference/android/content/ContentProviderClient#close()` in order to indicate to the system that the underlying `https://developer.android.com/reference/android/content/ContentProvider` is no longer needed and can be killed to free up resources.

Note that you should generally create a new ContentProviderClient instance for each thread that will be performing operations. Unlike `https://developer.android.com/reference/android/content/ContentResolver`, the methods here such as `https://developer.android.com/reference/android/content/ContentProviderClient#query(android.net.Uri,%20java.lang.String[],%20android.os.Bundle,%20android.os.CancellationSignal)` and `https://developer.android.com/reference/android/content/ContentProviderClient#openFile(android.net.Uri,%20java.lang.String)` are not thread safe -- you must not call `https://developer.android.com/reference/android/content/ContentProviderClient#close()` on the ContentProviderClient those calls are made from until you are finished with the data they have returned.

## Summary

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/content/ContentProviderResult` | ` https://developer.android.com/reference/android/content/ContentProviderClient#applyBatch(java.util.ArrayList<android.content.ContentProviderOperation>)(https://developer.android.com/reference/java/util/ArrayList<https://developer.android.com/reference/android/content/ContentProviderOperation> operations) ` See `https://developer.android.com/reference/android/content/ContentProvider#applyBatch(java.lang.String,%20java.util.ArrayList<android.content.ContentProviderOperation>)` |
| ` https://developer.android.com/reference/android/content/ContentProviderResult` | ` https://developer.android.com/reference/android/content/ContentProviderClient#applyBatch(java.lang.String,%20java.util.ArrayList<android.content.ContentProviderOperation>)(https://developer.android.com/reference/java/lang/String authority, https://developer.android.com/reference/java/util/ArrayList<https://developer.android.com/reference/android/content/ContentProviderOperation> operations) ` See `https://developer.android.com/reference/android/content/ContentProvider#applyBatch(java.lang.String,%20java.util.ArrayList<android.content.ContentProviderOperation>)` |
| ` int` | ` https://developer.android.com/reference/android/content/ContentProviderClient#bulkInsert(android.net.Uri,%20android.content.ContentValues[])(https://developer.android.com/reference/android/net/Uri url, https://developer.android.com/reference/android/content/ContentValues initialValues) ` See `https://developer.android.com/reference/android/content/ContentProvider#bulkInsert(android.net.Uri,%20android.content.ContentValues[])` |
| ` https://developer.android.com/reference/android/os/Bundle` | ` https://developer.android.com/reference/android/content/ContentProviderClient#call(java.lang.String,%20java.lang.String,%20java.lang.String,%20android.os.Bundle)(https://developer.android.com/reference/java/lang/String authority, https://developer.android.com/reference/java/lang/String method, https://developer.android.com/reference/java/lang/String arg, https://developer.android.com/reference/android/os/Bundle extras) ` See `https://developer.android.com/reference/android/content/ContentProvider#call(java.lang.String,%20java.lang.String,%20android.os.Bundle)` |
| ` https://developer.android.com/reference/android/os/Bundle` | ` https://developer.android.com/reference/android/content/ContentProviderClient#call(java.lang.String,%20java.lang.String,%20android.os.Bundle)(https://developer.android.com/reference/java/lang/String method, https://developer.android.com/reference/java/lang/String arg, https://developer.android.com/reference/android/os/Bundle extras) ` See `https://developer.android.com/reference/android/content/ContentProvider#call(java.lang.String,%20java.lang.String,%20android.os.Bundle)` |
| ` final https://developer.android.com/reference/android/net/Uri` | ` https://developer.android.com/reference/android/content/ContentProviderClient#canonicalize(android.net.Uri)(https://developer.android.com/reference/android/net/Uri url) ` See `https://developer.android.com/reference/android/content/ContentProvider#canonicalize(android.net.Uri)` |
| ` void` | ` https://developer.android.com/reference/android/content/ContentProviderClient#close()() ` Closes this client connection, indicating to the system that the underlying `https://developer.android.com/reference/android/content/ContentProvider` is no longer needed. |
| ` int` | ` https://developer.android.com/reference/android/content/ContentProviderClient#delete(android.net.Uri,%20java.lang.String,%20java.lang.String[])(https://developer.android.com/reference/android/net/Uri url, https://developer.android.com/reference/java/lang/String selection, https://developer.android.com/reference/java/lang/String selectionArgs) ` See `https://developer.android.com/reference/android/content/ContentProvider#delete(android.net.Uri,%20android.os.Bundle)` |
| ` int` | ` https://developer.android.com/reference/android/content/ContentProviderClient#delete(android.net.Uri,%20android.os.Bundle)(https://developer.android.com/reference/android/net/Uri url, https://developer.android.com/reference/android/os/Bundle extras) ` See `https://developer.android.com/reference/android/content/ContentProvider#delete(android.net.Uri,%20android.os.Bundle)` |
| ` https://developer.android.com/reference/android/content/ContentProvider` | ` https://developer.android.com/reference/android/content/ContentProviderClient#getLocalContentProvider()() ` Get a reference to the `https://developer.android.com/reference/android/content/ContentProvider` that is associated with this client. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/content/ContentProviderClient#getStreamTypes(android.net.Uri,%20java.lang.String)(https://developer.android.com/reference/android/net/Uri url, https://developer.android.com/reference/java/lang/String mimeTypeFilter) ` See `https://developer.android.com/reference/android/content/ContentProvider#getStreamTypes(android.net.Uri,%20java.lang.String)` |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/content/ContentProviderClient#getType(android.net.Uri)(https://developer.android.com/reference/android/net/Uri url) ` See `https://developer.android.com/reference/android/content/ContentProvider#getType(android.net.Uri)` |
| ` https://developer.android.com/reference/android/net/Uri` | ` https://developer.android.com/reference/android/content/ContentProviderClient#insert(android.net.Uri,%20android.content.ContentValues,%20android.os.Bundle)(https://developer.android.com/reference/android/net/Uri url, https://developer.android.com/reference/android/content/ContentValues initialValues, https://developer.android.com/reference/android/os/Bundle extras) ` See `https://developer.android.com/reference/android/content/ContentProvider#insert(android.net.Uri,%20android.content.ContentValues)` |
| ` https://developer.android.com/reference/android/net/Uri` | ` https://developer.android.com/reference/android/content/ContentProviderClient#insert(android.net.Uri,%20android.content.ContentValues)(https://developer.android.com/reference/android/net/Uri url, https://developer.android.com/reference/android/content/ContentValues initialValues) ` See `https://developer.android.com/reference/android/content/ContentProvider#insert(android.net.Uri,%20android.content.ContentValues)` |
| ` https://developer.android.com/reference/android/content/res/AssetFileDescriptor` | ` https://developer.android.com/reference/android/content/ContentProviderClient#openAssetFile(android.net.Uri,%20java.lang.String,%20android.os.CancellationSignal)(https://developer.android.com/reference/android/net/Uri url, https://developer.android.com/reference/java/lang/String mode, https://developer.android.com/reference/android/os/CancellationSignal signal) ` See `https://developer.android.com/reference/android/content/ContentProvider#openAssetFile(android.net.Uri,%20java.lang.String)`. |
| ` https://developer.android.com/reference/android/content/res/AssetFileDescriptor` | ` https://developer.android.com/reference/android/content/ContentProviderClient#openAssetFile(android.net.Uri,%20java.lang.String)(https://developer.android.com/reference/android/net/Uri url, https://developer.android.com/reference/java/lang/String mode) ` See `https://developer.android.com/reference/android/content/ContentProvider#openAssetFile(android.net.Uri,%20java.lang.String)`. |
| ` https://developer.android.com/reference/android/os/ParcelFileDescriptor` | ` https://developer.android.com/reference/android/content/ContentProviderClient#openFile(android.net.Uri,%20java.lang.String,%20android.os.CancellationSignal)(https://developer.android.com/reference/android/net/Uri url, https://developer.android.com/reference/java/lang/String mode, https://developer.android.com/reference/android/os/CancellationSignal signal) ` See `https://developer.android.com/reference/android/content/ContentProvider#openFile(android.net.Uri,%20java.lang.String)`. |
| ` https://developer.android.com/reference/android/os/ParcelFileDescriptor` | ` https://developer.android.com/reference/android/content/ContentProviderClient#openFile(android.net.Uri,%20java.lang.String)(https://developer.android.com/reference/android/net/Uri url, https://developer.android.com/reference/java/lang/String mode) ` See `https://developer.android.com/reference/android/content/ContentProvider#openFile(android.net.Uri,%20java.lang.String)`. |
| ` final https://developer.android.com/reference/android/content/res/AssetFileDescriptor` | ` https://developer.android.com/reference/android/content/ContentProviderClient#openTypedAssetFile(android.net.Uri,%20java.lang.String,%20android.os.Bundle,%20android.os.CancellationSignal)(https://developer.android.com/reference/android/net/Uri uri, https://developer.android.com/reference/java/lang/String mimeTypeFilter, https://developer.android.com/reference/android/os/Bundle opts, https://developer.android.com/reference/android/os/CancellationSignal signal) ` <br /> |
| ` final https://developer.android.com/reference/android/content/res/AssetFileDescriptor` | ` https://developer.android.com/reference/android/content/ContentProviderClient#openTypedAssetFileDescriptor(android.net.Uri,%20java.lang.String,%20android.os.Bundle,%20android.os.CancellationSignal)(https://developer.android.com/reference/android/net/Uri uri, https://developer.android.com/reference/java/lang/String mimeType, https://developer.android.com/reference/android/os/Bundle opts, https://developer.android.com/reference/android/os/CancellationSignal signal) ` See `https://developer.android.com/reference/android/content/ContentProvider#openTypedAssetFile(android.net.Uri,%20java.lang.String,%20android.os.Bundle)` |
| ` final https://developer.android.com/reference/android/content/res/AssetFileDescriptor` | ` https://developer.android.com/reference/android/content/ContentProviderClient#openTypedAssetFileDescriptor(android.net.Uri,%20java.lang.String,%20android.os.Bundle)(https://developer.android.com/reference/android/net/Uri uri, https://developer.android.com/reference/java/lang/String mimeType, https://developer.android.com/reference/android/os/Bundle opts) ` See `https://developer.android.com/reference/android/content/ContentProvider#openTypedAssetFile(android.net.Uri,%20java.lang.String,%20android.os.Bundle)` |
| ` https://developer.android.com/reference/android/database/Cursor` | ` https://developer.android.com/reference/android/content/ContentProviderClient#query(android.net.Uri,%20java.lang.String[],%20android.os.Bundle,%20android.os.CancellationSignal)(https://developer.android.com/reference/android/net/Uri uri, https://developer.android.com/reference/java/lang/String projection, https://developer.android.com/reference/android/os/Bundle queryArgs, https://developer.android.com/reference/android/os/CancellationSignal cancellationSignal) ` See `https://developer.android.com/reference/android/content/ContentProvider#query(android.net.Uri,%20java.lang.String[],%20android.os.Bundle,%20android.os.CancellationSignal)` |
| ` https://developer.android.com/reference/android/database/Cursor` | ` https://developer.android.com/reference/android/content/ContentProviderClient#query(android.net.Uri,%20java.lang.String[],%20java.lang.String,%20java.lang.String[],%20java.lang.String,%20android.os.CancellationSignal)(https://developer.android.com/reference/android/net/Uri uri, https://developer.android.com/reference/java/lang/String projection, https://developer.android.com/reference/java/lang/String selection, https://developer.android.com/reference/java/lang/String selectionArgs, https://developer.android.com/reference/java/lang/String sortOrder, https://developer.android.com/reference/android/os/CancellationSignal cancellationSignal) ` See `https://developer.android.com/reference/android/content/ContentProvider#query(android.net.Uri,%20java.lang.String[],%20android.os.Bundle,%20android.os.CancellationSignal)` |
| ` https://developer.android.com/reference/android/database/Cursor` | ` https://developer.android.com/reference/android/content/ContentProviderClient#query(android.net.Uri,%20java.lang.String[],%20java.lang.String,%20java.lang.String[],%20java.lang.String)(https://developer.android.com/reference/android/net/Uri url, https://developer.android.com/reference/java/lang/String projection, https://developer.android.com/reference/java/lang/String selection, https://developer.android.com/reference/java/lang/String selectionArgs, https://developer.android.com/reference/java/lang/String sortOrder) ` See `https://developer.android.com/reference/android/content/ContentProvider#query(android.net.Uri,%20java.lang.String[],%20android.os.Bundle,%20android.os.CancellationSignal)` |
| ` boolean` | ` https://developer.android.com/reference/android/content/ContentProviderClient#refresh(android.net.Uri,%20android.os.Bundle,%20android.os.CancellationSignal)(https://developer.android.com/reference/android/net/Uri url, https://developer.android.com/reference/android/os/Bundle extras, https://developer.android.com/reference/android/os/CancellationSignal cancellationSignal) ` See `https://developer.android.com/reference/android/content/ContentProvider#refresh(android.net.Uri,%20android.os.Bundle,%20android.os.CancellationSignal)` |
| ` boolean` | ` https://developer.android.com/reference/android/content/ContentProviderClient#release()() ` *This method was deprecated in API level 24. replaced by `https://developer.android.com/reference/android/content/ContentProviderClient#close()`.* |
| ` final https://developer.android.com/reference/android/net/Uri` | ` https://developer.android.com/reference/android/content/ContentProviderClient#uncanonicalize(android.net.Uri)(https://developer.android.com/reference/android/net/Uri url) ` See `https://developer.android.com/reference/android/content/ContentProvider#uncanonicalize(android.net.Uri)` |
| ` int` | ` https://developer.android.com/reference/android/content/ContentProviderClient#update(android.net.Uri,%20android.content.ContentValues,%20android.os.Bundle)(https://developer.android.com/reference/android/net/Uri url, https://developer.android.com/reference/android/content/ContentValues values, https://developer.android.com/reference/android/os/Bundle extras) ` See `https://developer.android.com/reference/android/content/ContentProvider#update(android.net.Uri,%20android.content.ContentValues,%20android.os.Bundle)` |
| ` int` | ` https://developer.android.com/reference/android/content/ContentProviderClient#update(android.net.Uri,%20android.content.ContentValues,%20java.lang.String,%20java.lang.String[])(https://developer.android.com/reference/android/net/Uri url, https://developer.android.com/reference/android/content/ContentValues values, https://developer.android.com/reference/java/lang/String selection, https://developer.android.com/reference/java/lang/String selectionArgs) ` See `https://developer.android.com/reference/android/content/ContentProvider#update(android.net.Uri,%20android.content.ContentValues,%20android.os.Bundle)` |

| ### Protected methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/content/ContentProviderClient#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.
From interface ` https://developer.android.com/reference/java/lang/AutoCloseable ` ` abstract void` ` https://developer.android.com/reference/java/lang/AutoCloseable#close()() `

Closes this resource, relinquishing any underlying resources.

## Public methods

### applyBatch

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

```
public ContentProviderResult[] applyBatch (ArrayList<ContentProviderOperation> operations)
```

See `https://developer.android.com/reference/android/content/ContentProvider#applyBatch(java.lang.String,%20java.util.ArrayList<android.content.ContentProviderOperation>)`

<br />

| Parameters ||
|---|---|
| `operations` | `ArrayList`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/ContentProviderResult` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/OperationApplicationException` |   |
| `https://developer.android.com/reference/android/os/RemoteException` |   |

### applyBatch

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

```
public ContentProviderResult[] applyBatch (String authority, 
                ArrayList<ContentProviderOperation> operations)
```

See `https://developer.android.com/reference/android/content/ContentProvider#applyBatch(java.lang.String,%20java.util.ArrayList<android.content.ContentProviderOperation>)`

<br />

| Parameters ||
|---|---|
| `authority` | `String`: This value cannot be `null`. <br /> |
| `operations` | `ArrayList`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/ContentProviderResult` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/OperationApplicationException` |   |
| `https://developer.android.com/reference/android/os/RemoteException` |   |

### bulkInsert

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

```
public int bulkInsert (Uri url, 
                ContentValues[] initialValues)
```

See `https://developer.android.com/reference/android/content/ContentProvider#bulkInsert(android.net.Uri,%20android.content.ContentValues[])`

<br />

| Parameters ||
|---|---|
| `url` | `Uri`: This value cannot be `null`. <br /> |
| `initialValues` | `ContentValues`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `int` | <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/os/RemoteException` |   |

### call

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

```
public Bundle call (String authority, 
                String method, 
                String arg, 
                Bundle extras)
```

See `https://developer.android.com/reference/android/content/ContentProvider#call(java.lang.String,%20java.lang.String,%20android.os.Bundle)`

<br />

| Parameters ||
|---|---|
| `authority` | `String`: This value cannot be `null`. <br /> |
| `method` | `String`: This value cannot be `null`. <br /> |
| `arg` | `String`: This value may be `null`. <br /> |
| `extras` | `Bundle`: This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/os/Bundle` | This value may be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/os/RemoteException` |   |

### call

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

```
public Bundle call (String method, 
                String arg, 
                Bundle extras)
```

See `https://developer.android.com/reference/android/content/ContentProvider#call(java.lang.String,%20java.lang.String,%20android.os.Bundle)`

<br />

| Parameters ||
|---|---|
| `method` | `String`: This value cannot be `null`. <br /> |
| `arg` | `String`: This value may be `null`. <br /> |
| `extras` | `Bundle`: This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/os/Bundle` | This value may be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/os/RemoteException` |   |

### canonicalize

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

```
public final Uri canonicalize (Uri url)
```

See `https://developer.android.com/reference/android/content/ContentProvider#canonicalize(android.net.Uri)`

<br />

| Parameters ||
|---|---|
| `url` | `Uri`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/Uri` | This value may be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/os/RemoteException` |   |

### close

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

```
public void close ()
```

Closes this client connection, indicating to the system that the underlying `https://developer.android.com/reference/android/content/ContentProvider` is no longer needed.

<br />

### delete

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

```
public int delete (Uri url, 
                String selection, 
                String[] selectionArgs)
```

See `https://developer.android.com/reference/android/content/ContentProvider#delete(android.net.Uri,%20android.os.Bundle)`

<br />

| Parameters ||
|---|---|
| `url` | `Uri`: This value cannot be `null`. <br /> |
| `selection` | `String`: This value may be `null`. <br /> |
| `selectionArgs` | `String`: This value may be `null`. <br /> |

| Returns ||
|---|---|
| `int` | <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/os/RemoteException` |   |

### delete

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

```
public int delete (Uri url, 
                Bundle extras)
```

See `https://developer.android.com/reference/android/content/ContentProvider#delete(android.net.Uri,%20android.os.Bundle)`

<br />

| Parameters ||
|---|---|
| `url` | `Uri`: This value cannot be `null`. <br /> |
| `extras` | `Bundle`: This value may be `null`. <br /> |

| Returns ||
|---|---|
| `int` | <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/os/RemoteException` |   |

### getLocalContentProvider

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

```
public ContentProvider getLocalContentProvider ()
```

Get a reference to the `https://developer.android.com/reference/android/content/ContentProvider` that is associated with this client. If the `https://developer.android.com/reference/android/content/ContentProvider` is running in a different process then null will be returned. This can be used if you know you are running in the same process as a provider, and want to get direct access to its implementation details.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/ContentProvider` | If the associated `https://developer.android.com/reference/android/content/ContentProvider` is local, returns it. Otherwise returns null. <br /> |

### getStreamTypes

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

```
public String[] getStreamTypes (Uri url, 
                String mimeTypeFilter)
```

See `https://developer.android.com/reference/android/content/ContentProvider#getStreamTypes(android.net.Uri,%20java.lang.String)`

<br />

| Parameters ||
|---|---|
| `url` | `Uri`: This value cannot be `null`. <br /> |
| `mimeTypeFilter` | `String`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | This value may be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/os/RemoteException` |   |

### getType

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

```
public String getType (Uri url)
```

See `https://developer.android.com/reference/android/content/ContentProvider#getType(android.net.Uri)`

<br />

| Parameters ||
|---|---|
| `url` | `Uri`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | This value may be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/os/RemoteException` |   |

### insert

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

```
public Uri insert (Uri url, 
                ContentValues initialValues, 
                Bundle extras)
```

See `https://developer.android.com/reference/android/content/ContentProvider#insert(android.net.Uri,%20android.content.ContentValues)`

<br />

| Parameters ||
|---|---|
| `url` | `Uri`: This value cannot be `null`. <br /> |
| `initialValues` | `ContentValues`: This value may be `null`. <br /> |
| `extras` | `Bundle`: This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/Uri` | This value may be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/os/RemoteException` |   |

### insert

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

```
public Uri insert (Uri url, 
                ContentValues initialValues)
```

See `https://developer.android.com/reference/android/content/ContentProvider#insert(android.net.Uri,%20android.content.ContentValues)`

<br />

| Parameters ||
|---|---|
| `url` | `Uri`: This value cannot be `null`. <br /> |
| `initialValues` | `ContentValues`: This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/Uri` | This value may be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/os/RemoteException` |   |

### openAssetFile

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

```
public AssetFileDescriptor openAssetFile (Uri url, 
                String mode, 
                CancellationSignal signal)
```

See `https://developer.android.com/reference/android/content/ContentProvider#openAssetFile(android.net.Uri,%20java.lang.String)`. Note that this *does not* take care of non-content: URIs such as file:. It is strongly recommended you use the `https://developer.android.com/reference/android/content/ContentResolver#openAssetFileDescriptor(android.net.Uri,%20java.lang.String)` API instead.

<br />

| Parameters ||
|---|---|
| `url` | `Uri`: This value cannot be `null`. <br /> |
| `mode` | `String`: This value cannot be `null`. <br /> |
| `signal` | `CancellationSignal`: This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/res/AssetFileDescriptor` | This value may be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/io/FileNotFoundException` |   |
| `https://developer.android.com/reference/android/os/RemoteException` |   |

### openAssetFile

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

```
public AssetFileDescriptor openAssetFile (Uri url, 
                String mode)
```

See `https://developer.android.com/reference/android/content/ContentProvider#openAssetFile(android.net.Uri,%20java.lang.String)`. Note that this *does not* take care of non-content: URIs such as file:. It is strongly recommended you use the `https://developer.android.com/reference/android/content/ContentResolver#openAssetFileDescriptor(android.net.Uri,%20java.lang.String)` API instead.

<br />

| Parameters ||
|---|---|
| `url` | `Uri`: This value cannot be `null`. <br /> |
| `mode` | `String`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/res/AssetFileDescriptor` | This value may be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/io/FileNotFoundException` |   |
| `https://developer.android.com/reference/android/os/RemoteException` |   |

### openFile

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

```
public ParcelFileDescriptor openFile (Uri url, 
                String mode, 
                CancellationSignal signal)
```

See `https://developer.android.com/reference/android/content/ContentProvider#openFile(android.net.Uri,%20java.lang.String)`. Note that this *does not* take care of non-content: URIs such as file:. It is strongly recommended you use the `https://developer.android.com/reference/android/content/ContentResolver#openFileDescriptor(android.net.Uri,%20java.lang.String)` API instead.

<br />

| Parameters ||
|---|---|
| `url` | `Uri`: This value cannot be `null`. <br /> |
| `mode` | `String`: This value cannot be `null`. <br /> |
| `signal` | `CancellationSignal`: This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/os/ParcelFileDescriptor` | This value may be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/io/FileNotFoundException` |   |
| `https://developer.android.com/reference/android/os/RemoteException` |   |

### openFile

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

```
public ParcelFileDescriptor openFile (Uri url, 
                String mode)
```

See `https://developer.android.com/reference/android/content/ContentProvider#openFile(android.net.Uri,%20java.lang.String)`. Note that this *does not* take care of non-content: URIs such as file:. It is strongly recommended you use the `https://developer.android.com/reference/android/content/ContentResolver#openFileDescriptor(android.net.Uri,%20java.lang.String)` API instead.

<br />

| Parameters ||
|---|---|
| `url` | `Uri`: This value cannot be `null`. <br /> |
| `mode` | `String`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/os/ParcelFileDescriptor` | This value may be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/io/FileNotFoundException` |   |
| `https://developer.android.com/reference/android/os/RemoteException` |   |

### openTypedAssetFile

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

```
public final AssetFileDescriptor openTypedAssetFile (Uri uri, 
                String mimeTypeFilter, 
                Bundle opts, 
                CancellationSignal signal)
```

<br />

<br />

| Parameters ||
|---|---|
| `uri` | `Uri`: This value cannot be `null`. <br /> |
| `mimeTypeFilter` | `String`: This value cannot be `null`. <br /> |
| `opts` | `Bundle`: This value may be `null`. <br /> |
| `signal` | `CancellationSignal`: This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/res/AssetFileDescriptor` | This value may be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/io/FileNotFoundException` |   |
| `https://developer.android.com/reference/android/os/RemoteException` |   |

### openTypedAssetFileDescriptor

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

```
public final AssetFileDescriptor openTypedAssetFileDescriptor (Uri uri, 
                String mimeType, 
                Bundle opts, 
                CancellationSignal signal)
```

See `https://developer.android.com/reference/android/content/ContentProvider#openTypedAssetFile(android.net.Uri,%20java.lang.String,%20android.os.Bundle)`

<br />

| Parameters ||
|---|---|
| `uri` | `Uri`: This value cannot be `null`. <br /> |
| `mimeType` | `String`: This value cannot be `null`. <br /> |
| `opts` | `Bundle`: This value may be `null`. <br /> |
| `signal` | `CancellationSignal`: This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/res/AssetFileDescriptor` | This value may be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/io/FileNotFoundException` |   |
| `https://developer.android.com/reference/android/os/RemoteException` |   |

### openTypedAssetFileDescriptor

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

```
public final AssetFileDescriptor openTypedAssetFileDescriptor (Uri uri, 
                String mimeType, 
                Bundle opts)
```

See `https://developer.android.com/reference/android/content/ContentProvider#openTypedAssetFile(android.net.Uri,%20java.lang.String,%20android.os.Bundle)`

<br />

| Parameters ||
|---|---|
| `uri` | `Uri`: This value cannot be `null`. <br /> |
| `mimeType` | `String`: This value cannot be `null`. <br /> |
| `opts` | `Bundle`: This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/res/AssetFileDescriptor` | This value may be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/io/FileNotFoundException` |   |
| `https://developer.android.com/reference/android/os/RemoteException` |   |

### query

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

```
public Cursor query (Uri uri, 
                String[] projection, 
                Bundle queryArgs, 
                CancellationSignal cancellationSignal)
```

See `https://developer.android.com/reference/android/content/ContentProvider#query(android.net.Uri,%20java.lang.String[],%20android.os.Bundle,%20android.os.CancellationSignal)`

<br />

| Parameters ||
|---|---|
| `uri` | `Uri`: This value cannot be `null`. <br /> |
| `projection` | `String`: This value may be `null`. <br /> |
| `queryArgs` | `Bundle` <br /> |
| `cancellationSignal` | `CancellationSignal`: This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/database/Cursor` | This value may be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/os/RemoteException` |   |

### query

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

```
public Cursor query (Uri uri, 
                String[] projection, 
                String selection, 
                String[] selectionArgs, 
                String sortOrder, 
                CancellationSignal cancellationSignal)
```

See `https://developer.android.com/reference/android/content/ContentProvider#query(android.net.Uri,%20java.lang.String[],%20android.os.Bundle,%20android.os.CancellationSignal)`

<br />

| Parameters ||
|---|---|
| `uri` | `Uri`: This value cannot be `null`. <br /> |
| `projection` | `String`: This value may be `null`. <br /> |
| `selection` | `String`: This value may be `null`. <br /> |
| `selectionArgs` | `String`: This value may be `null`. <br /> |
| `sortOrder` | `String`: This value may be `null`. <br /> |
| `cancellationSignal` | `CancellationSignal`: This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/database/Cursor` | This value may be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/os/RemoteException` |   |

### query

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

```
public Cursor query (Uri url, 
                String[] projection, 
                String selection, 
                String[] selectionArgs, 
                String sortOrder)
```

See `https://developer.android.com/reference/android/content/ContentProvider#query(android.net.Uri,%20java.lang.String[],%20android.os.Bundle,%20android.os.CancellationSignal)`

<br />

| Parameters ||
|---|---|
| `url` | `Uri`: This value cannot be `null`. <br /> |
| `projection` | `String`: This value may be `null`. <br /> |
| `selection` | `String`: This value may be `null`. <br /> |
| `selectionArgs` | `String`: This value may be `null`. <br /> |
| `sortOrder` | `String`: This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/database/Cursor` | This value may be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/os/RemoteException` |   |

### refresh

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

```
public boolean refresh (Uri url, 
                Bundle extras, 
                CancellationSignal cancellationSignal)
```

See `https://developer.android.com/reference/android/content/ContentProvider#refresh(android.net.Uri,%20android.os.Bundle,%20android.os.CancellationSignal)`

<br />

| Parameters ||
|---|---|
| `url` | `Uri` <br /> |
| `extras` | `Bundle`: This value may be `null`. <br /> |
| `cancellationSignal` | `CancellationSignal`: This value may be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/os/RemoteException` |   |

### release

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

```
public boolean release ()
```

<br />

**This method was deprecated in API level 24.**   

replaced by `https://developer.android.com/reference/android/content/ContentProviderClient#close()`.

<br />

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### uncanonicalize

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

```
public final Uri uncanonicalize (Uri url)
```

See `https://developer.android.com/reference/android/content/ContentProvider#uncanonicalize(android.net.Uri)`

<br />

| Parameters ||
|---|---|
| `url` | `Uri`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/Uri` | This value may be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/os/RemoteException` |   |

### update

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

```
public int update (Uri url, 
                ContentValues values, 
                Bundle extras)
```

See `https://developer.android.com/reference/android/content/ContentProvider#update(android.net.Uri,%20android.content.ContentValues,%20android.os.Bundle)`

<br />

| Parameters ||
|---|---|
| `url` | `Uri`: This value cannot be `null`. <br /> |
| `values` | `ContentValues`: This value may be `null`. <br /> |
| `extras` | `Bundle`: This value may be `null`. <br /> |

| Returns ||
|---|---|
| `int` | <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/os/RemoteException` |   |

### update

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

```
public int update (Uri url, 
                ContentValues values, 
                String selection, 
                String[] selectionArgs)
```

See `https://developer.android.com/reference/android/content/ContentProvider#update(android.net.Uri,%20android.content.ContentValues,%20android.os.Bundle)`

<br />

| Parameters ||
|---|---|
| `url` | `Uri`: This value cannot be `null`. <br /> |
| `values` | `ContentValues`: This value may be `null`. <br /> |
| `selection` | `String`: This value may be `null`. <br /> |
| `selectionArgs` | `String`: This value may be `null`. <br /> |

| Returns ||
|---|---|
| `int` | <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/os/RemoteException` |   |

## Protected methods

### finalize

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

```
protected void finalize ()
```

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. A subclass overrides the `finalize` method to dispose of system resources or to perform other cleanup.

The general contract of `finalize` is that it is invoked if and when the Java virtual machine has determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, except as a result of an action taken by the finalization of some other object or class which is ready to be finalized. The `finalize` method may take any action, including making this object available again to other threads; the usual purpose of `finalize`, however, is to perform cleanup actions before the object is irrevocably discarded. For example, the finalize method for an object that represents an input/output connection might perform explicit I/O transactions to break the connection before the object is permanently discarded.

The `finalize` method of class `Object` performs no special action; it simply returns normally. Subclasses of `Object` may override this definition.

The Java programming language does not guarantee which thread will invoke the `finalize` method for any given object. It is guaranteed, however, that the thread that invokes finalize will not be holding any user-visible synchronization locks when finalize is invoked. If an uncaught exception is thrown by the finalize method, the exception is ignored and finalization of that object terminates.

After the `finalize` method has been invoked for an object, no further action is taken until the Java virtual machine has again determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, including possible actions by other objects or classes which are ready to be finalized, at which point the object may be discarded.

The `finalize` method is never invoked more than once by a Java virtual machine for any given object.

Any exception thrown by the `finalize` method causes the finalization of this object to be halted, but is otherwise ignored.

<br />

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/Throwable` |   |