0% found this document useful (0 votes)
5 views36 pages

ContentProviderClient - API Reference - Android Developers

The document provides an API reference for the ContentProviderClient class in Android, which is used to interact with ContentProviders. It details how to obtain instances of ContentProviderClient, the importance of releasing them properly, and lists various public methods available for operations like querying, inserting, and deleting data. Additionally, it highlights that instances should be created per thread due to non-thread-safe methods.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views36 pages

ContentProviderClient - API Reference - Android Developers

The document provides an API reference for the ContentProviderClient class in Android, which is used to interact with ContentProviders. It details how to obtain instances of ContentProviderClient, the importance of releasing them properly, and lists various public methods available for operations like querying, inserting, and deleting data. Additionally, it highlights that instances should be created per thread due to non-thread-safe methods.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

Content Added in API level 5 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

ProviderClient
Kotlin (/reference/kotlin/android/content/ContentProviderClient) | Java

public class ContentProviderClient


extends Object (/reference/java/lang/Object) implements AutoCloseable
(/reference/java/lang/AutoCloseable)

[Link] (/reference/java/lang/Object)
↳ [Link]

The public interface object used to interact with a specific ContentProvider


(/reference/android/content/ContentProvider) .

Instances can be obtained by calling [Link]


(/reference/android/content/ContentResolver#acquireContentProviderClient([Link])) or
[Link]
(/reference/android/content/ContentResolver#acquireUnstableContentProviderClient([Link]))
. Instances must be released using close()
(/reference/android/content/ContentProviderClient#close()) in order to indicate to the system
that the underlying ContentProvider (/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 ContentResolver
(/reference/android/content/ContentResolver) , the methods here such as query(Uri, String,
Bundle, CancellationSignal)
(/reference/android/content/ContentProviderClient#query([Link],%[Link][],%20a
[Link],%[Link]))
and openFile(Uri, String)
(/reference/android/content/ContentProviderClient#openFile([Link],%[Link]))
are not thread safe -- you must not call close()
(/reference/android/content/ContentProviderClient#close()) on the ContentProviderClient those
calls are made from until you are finished with the data they have returned.

[Link] 1/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

Summary

Public methods

ContentProviderResult[] applyBatch (/reference/android/content/Content


(/reference/android/content/ContentProviderResult) <ContentProviderOperation (/reference/andr

See [Link] (/reference

ContentProviderResult[] applyBatch (/reference/android/content/Content


(/reference/android/content/ContentProviderResult) (/reference/java/lang/String) authority, Arra

See [Link] (/reference

int bulkInsert (/reference/android/content/Content


(/reference/android/content/ContentValues) init

See [Link] (/reference

Bundle (/reference/android/os/Bundle) call (/reference/android/content/ContentProvider


authority, String (/reference/java/lang/String

See [Link](String, String

Bundle (/reference/android/os/Bundle) call (/reference/android/content/ContentProvider


(/reference/java/lang/String) arg, Bundle (/refe

See [Link](String, String

final Uri (/reference/android/net/Uri) canonicalize (/reference/android/content/Conte

See [Link] (/referen

void close (/reference/android/content/ContentProvid

Closes this client connection, indicating to the sys

int delete (/reference/android/content/ContentProvi


(/reference/java/lang/String) selection, Stri

See [Link] (/reference/andr

[Link] 2/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

int delete (/reference/android/content/ContentProvi


extras)

See [Link] (/reference/andr

ContentProvider getLocalContentProvider (/reference/android


(/reference/android/content/ContentProvider)
Get a reference to the ContentProvider (/refere

String[] (/reference/java/lang/String) getStreamTypes (/reference/android/content/Co


(/reference/java/lang/String) mimeTypeFilter)

See [Link] (/refe

String (/reference/java/lang/String) getType (/reference/android/content/ContentProv

See [Link] (/reference/and

Uri (/reference/android/net/Uri) insert (/reference/android/content/ContentProvi


ContentValues (/reference/android/content/Con

See [Link] (/reference/andr

Uri (/reference/android/net/Uri) insert (/reference/android/content/ContentProvi


(/reference/android/content/ContentValues) init

See [Link] (/reference/andr

AssetFileDescriptor openAssetFile (/reference/android/content/Con


(/reference/android/content/res/AssetFileDescriptor) url, String (/reference/java/lang/String) mode

See [Link] (/refere

AssetFileDescriptor openAssetFile (/reference/android/content/Con


(/reference/android/content/res/AssetFileDescriptor) (/reference/java/lang/String) mode)

See [Link] (/refere

ParcelFileDescriptor openFile (/reference/android/content/ContentPro


(/reference/android/os/ParcelFileDescriptor) (/reference/java/lang/String) mode, Cancellat

See [Link] (/reference/a

[Link] 3/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

ParcelFileDescriptor openFile (/reference/android/content/ContentPro


(/reference/android/os/ParcelFileDescriptor) mode)

See [Link] (/reference/a

final AssetFileDescriptor openTypedAssetFile (/reference/android/conte


(/reference/android/content/res/AssetFileDescriptor) (Uri (/reference/android/net/Uri) uri, String
(/reference/android/os/CancellationSignal) signa

final AssetFileDescriptor openTypedAssetFileDescriptor


(/reference/android/content/res/AssetFileDescriptor) (/reference/android/content/ContentProviderClien
(/reference/android/net/Uri) uri, String (/refe
(/reference/android/os/CancellationSignal) signa

See [Link]

final AssetFileDescriptor openTypedAssetFileDescriptor (/reference/a


(/reference/android/content/res/AssetFileDescriptor) (/reference/android/net/Uri) uri, String (/refe

See [Link]

Cursor (/reference/android/database/Cursor) query (/reference/android/content/ContentProvid


(/reference/android/net/Uri) uri, String[] (/re
(/reference/android/os/CancellationSignal) cance

See [Link] (/reference/andro

Cursor (/reference/android/database/Cursor) query


(/reference/android/content/ContentProviderClien
(Uri (/reference/android/net/Uri) uri, String[
selectionArgs, String (/reference/java/lang/

See [Link] (/reference/andro

Cursor (/reference/android/database/Cursor) query (/reference/android/content/ContentProvid


(/reference/android/net/Uri) url, String[] (/re
selectionArgs, String (/reference/java/lang/

See [Link] (/reference/andro

[Link] 4/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

boolean refresh (/reference/android/content/ContentProv


(/reference/android/os/Bundle) extras, Cance

See [Link] (/reference/and

boolean release (/reference/android/content/ContentProv

This method was deprecated in API level 24. replac

final Uri (/reference/android/net/Uri) uncanonicalize (/reference/android/content/Co

See [Link] (/refe

int update (/reference/android/content/ContentProvi


ContentValues (/reference/android/content/Con

See [Link] (/reference/andr

int update (/reference/android/content/ContentProvi


(/reference/android/net/Uri) url, ContentValu
(/reference/java/lang/String) selectionArgs)

See [Link] (/reference/andr

Protected methods

void finalize (/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 [Link] (/reference/java/lang/Object)


Object (/reference/java/lang/Object) clone (/reference/java/lang/Object#clone())()

Creates and returns a copy of this object.

boolean equals
(/reference/java/lang/Object#equals([Link])

[Link] 5/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

(Object (/reference/java/lang/Object) obj)

Indicates whether some other object is "equal to" this


one.

void finalize (/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 Class (/reference/java/lang/Class)<?> getClass (/reference/java/lang/Object#getClass())()

Returns the runtime class of this Object .

int hashCode (/reference/java/lang/Object#hashCode())


()

Returns a hash code value for the object.

final void notify (/reference/java/lang/Object#notify())()

Wakes up a single thread that is waiting on this


object's monitor.

final void notifyAll (/reference/java/lang/Object#notifyAll())


()

Wakes up all threads that are waiting on this object's


monitor.

String (/reference/java/lang/String) toString (/reference/java/lang/Object#toString())()

Returns a string representation of the object.

final void wait (/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 wait (/reference/java/lang/Object#wait(long))(long


timeoutMillis)

[Link] 6/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

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 wait (/reference/java/lang/Object#wait())()

Causes the current thread to wait until it is awakened,


typically by being notified or interrupted.

From interface [Link] (/reference/java/lang/AutoCloseable)


abstract void close (/reference/java/lang/AutoCloseable#close())()

Closes this resource, relinquishing any underlying resources.

Public methods

applyBatch Added in API level 5 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public ContentProviderResult[] (/reference/android/content/ContentProviderResult) applyBa

See [Link]
(/reference/android/content/ContentProvider#applyBatch([Link],%[Link]<andr
[Link]>))

Parameters

operations ArrayList : This value cannot be null .

Returns

[Link] 7/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

ContentProviderResult[] This value cannot be null .


(/reference/android/content/ContentProviderResult)

Throws

OperationApplicationException
(/reference/android/content/OperationApplicationException)

RemoteException
(/reference/android/os/RemoteException)

applyBatch Added in API level 29 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public ContentProviderResult[] (/reference/android/content/ContentProviderResult) applyBa


ArrayList (/reference/java/util/ArrayList)<ContentProviderOperation (/refe

See [Link]
(/reference/android/content/ContentProvider#applyBatch([Link],%[Link]<andr
[Link]>))

Parameters

authority String : This value cannot be null .

operations ArrayList : This value cannot be null .

Returns

[Link] 8/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

ContentProviderResult[] This value cannot be null .


(/reference/android/content/ContentProviderResult)

Throws

OperationApplicationException
(/reference/android/content/OperationApplicationException)

RemoteException
(/reference/android/os/RemoteException)

bulkInsert Added in API level 5 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public int bulkInsert (Uri (/reference/android/net/Uri) url,


ContentValues[] (/reference/android/content/ContentValues) initialValue

See [Link]
(/reference/android/content/ContentProvider#bulkInsert([Link],%[Link]
Values[]))

Parameters

url Uri : This value cannot be null .

initialValues ContentValues : This value cannot be null .

Returns

[Link] 9/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

int

Throws

RemoteException
(/reference/android/os/RemoteException)

call Added in API level 29 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public Bundle (/reference/android/os/Bundle) call (String (/reference/java/lang/String) autho


String (/reference/java/lang/String) method,
String (/reference/java/lang/String) arg,
Bundle (/reference/android/os/Bundle) extras)

See [Link](String, String, Bundle)


(/reference/android/content/ContentProvider#call([Link],%[Link],%[Link]
.Bundle))

Parameters

authority String : This value cannot be null .

method String : This value cannot be null .

arg String : This value may be null .

extras Bundle : This value may be null .

[Link] 10/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

Returns

Bundle This value may be null .


(/reference/android/os/Bundle)

Throws

RemoteException
(/reference/android/os/RemoteException)

call Added in API level 17 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public Bundle (/reference/android/os/Bundle) call (String (/reference/java/lang/String) metho


String (/reference/java/lang/String) arg,
Bundle (/reference/android/os/Bundle) extras)

See [Link](String, String, Bundle)


(/reference/android/content/ContentProvider#call([Link],%[Link],%[Link]
.Bundle))

Parameters

method String : This value cannot be null .

arg String : This value may be null .

extras Bundle : This value may be null .

[Link] 11/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

Returns

Bundle This value may be null .


(/reference/android/os/Bundle)

Throws

RemoteException
(/reference/android/os/RemoteException)

canonicalize Added in API level 19 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public final Uri (/reference/android/net/Uri) canonicalize (Uri (/reference/android/net/Uri)

See [Link]
(/reference/android/content/ContentProvider#canonicalize([Link]))

Parameters

url Uri : This value cannot be null .

Returns

Uri (/reference/android/net/Uri) This value may be null .

Throws

[Link] 12/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

RemoteException
(/reference/android/os/RemoteException)

close Added in API level 24 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public void close ()

Closes this client connection, indicating to the system that the underlying
ContentProvider (/reference/android/content/ContentProvider) is no longer needed.

delete Added in API level 5 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public int delete (Uri (/reference/android/net/Uri) url,


String (/reference/java/lang/String) selection,
String[] (/reference/java/lang/String) selectionArgs)

See [Link]
(/reference/android/content/ContentProvider#delete([Link],%[Link]))

Parameters

url Uri : This value cannot be null .

selection String : This value may be null .

selectionArgs String : This value may be null .

[Link] 13/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

Returns

int

Throws

RemoteException
(/reference/android/os/RemoteException)

delete Added in API level 30 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public int delete (Uri (/reference/android/net/Uri) url,


Bundle (/reference/android/os/Bundle) extras)

See [Link]
(/reference/android/content/ContentProvider#delete([Link],%[Link]))

Parameters

url Uri : This value cannot be null .

extras Bundle : This value may be null .

Returns

int

[Link] 14/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

Throws

RemoteException
(/reference/android/os/RemoteException)

getLocalContentProvider
Added in API level 5 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public ContentProvider (/reference/android/content/ContentProvider) getLocalContentProvi

Get a reference to the ContentProvider (/reference/android/content/ContentProvider) that is


associated with this client. If the ContentProvider
(/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.

Returns

ContentProvider If the associated ContentProvider


(/reference/android/content/ContentProvider) (/reference/android/content/ContentProvider) is local,
returns it. Otherwise returns null.

getStreamTypes Added in API level 11 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public String[] (/reference/java/lang/String) getStreamTypes (Uri (/reference/android/net/Uri)


String (/reference/java/lang/String) mimeTypeFilter)

See [Link]
(/reference/android/content/ContentProvider#getStreamTypes([Link],%[Link]))

[Link] 15/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

Parameters

url Uri : This value cannot be null .

mimeTypeFilter String : This value cannot be null .

Returns

String[] This value may be null .


(/reference/java/lang/String)

Throws

RemoteException
(/reference/android/os/RemoteException)

getType Added in API level 5 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public String (/reference/java/lang/String) getType (Uri (/reference/android/net/Uri) url)

See [Link]
(/reference/android/content/ContentProvider#getType([Link]))

Parameters

url Uri : This value cannot be null .

[Link] 16/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

Returns

String This value may be null .


(/reference/java/lang/String)

Throws

RemoteException
(/reference/android/os/RemoteException)

insert Added in API level 30 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public Uri (/reference/android/net/Uri) insert (Uri (/reference/android/net/Uri) url,


ContentValues (/reference/android/content/ContentValues) initialValues,
Bundle (/reference/android/os/Bundle) extras)

See [Link]
(/reference/android/content/ContentProvider#insert([Link],%[Link]
es))

Parameters

url Uri : This value cannot be null .

initialValues ContentValues : This value may be null .

extras Bundle : This value may be null .

[Link] 17/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

Returns

Uri (/reference/android/net/Uri) This value may be null .

Throws

RemoteException
(/reference/android/os/RemoteException)

insert Added in API level 5 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public Uri (/reference/android/net/Uri) insert (Uri (/reference/android/net/Uri) url,


ContentValues (/reference/android/content/ContentValues) initialValues)

See [Link]
(/reference/android/content/ContentProvider#insert([Link],%[Link]
es))

Parameters

url Uri : This value cannot be null .

initialValues ContentValues : This value may be null .

Returns

Uri (/reference/android/net/Uri) This value may be null .

[Link] 18/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

Throws

RemoteException
(/reference/android/os/RemoteException)

openAssetFile Added in API level 19 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public AssetFileDescriptor (/reference/android/content/res/AssetFileDescriptor) openAssetFi


String (/reference/java/lang/String) mode,
CancellationSignal (/reference/android/os/CancellationSignal) signal)

See [Link]
(/reference/android/content/ContentProvider#openAssetFile([Link],%[Link])) .
Note that this does not take care of non-content: URIs such as file:. It is strongly
recommended you use the [Link]
(/reference/android/content/ContentResolver#openAssetFileDescriptor([Link],%[Link].
String))
API instead.

Parameters

url Uri : This value cannot be null .

mode String : This value cannot be null .

signal CancellationSignal : This value may be null .

Returns

[Link] 19/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

AssetFileDescriptor This value may be null .


(/reference/android/content/res/AssetFileDescriptor)

Throws

FileNotFoundException
(/reference/java/io/FileNotFoundException)

RemoteException
(/reference/android/os/RemoteException)

openAssetFile Added in API level 5 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public AssetFileDescriptor (/reference/android/content/res/AssetFileDescriptor) openAssetFi


String (/reference/java/lang/String) mode)

See [Link]
(/reference/android/content/ContentProvider#openAssetFile([Link],%[Link])) .
Note that this does not take care of non-content: URIs such as file:. It is strongly
recommended you use the [Link]
(/reference/android/content/ContentResolver#openAssetFileDescriptor([Link],%[Link].
String))
API instead.

Parameters

url Uri : This value cannot be null .

mode String : This value cannot be null .

[Link] 20/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

Returns

AssetFileDescriptor This value may be null .


(/reference/android/content/res/AssetFileDescriptor)

Throws

FileNotFoundException
(/reference/java/io/FileNotFoundException)

RemoteException
(/reference/android/os/RemoteException)

openFile Added in API level 19 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public ParcelFileDescriptor (/reference/android/os/ParcelFileDescriptor) openFile (Uri (/re


String (/reference/java/lang/String) mode,
CancellationSignal (/reference/android/os/CancellationSignal) signal)

See [Link]
(/reference/android/content/ContentProvider#openFile([Link],%[Link])) . Note
that this does not take care of non-content: URIs such as file:. It is strongly recommended
you use the [Link]
(/reference/android/content/ContentResolver#openFileDescriptor([Link],%[Link])
)
API instead.

Parameters

url Uri : This value cannot be null .

[Link] 21/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

mode String : This value cannot be null .

signal CancellationSignal : This value may be null .

Returns

ParcelFileDescriptor This value may be null .


(/reference/android/os/ParcelFileDescriptor)

Throws

FileNotFoundException
(/reference/java/io/FileNotFoundException)

RemoteException
(/reference/android/os/RemoteException)

openFile Added in API level 5 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public ParcelFileDescriptor (/reference/android/os/ParcelFileDescriptor) openFile (Uri (/re


String (/reference/java/lang/String) mode)

See [Link]
(/reference/android/content/ContentProvider#openFile([Link],%[Link])) . Note
that this does not take care of non-content: URIs such as file:. It is strongly recommended
you use the [Link]
(/reference/android/content/ContentResolver#openFileDescriptor([Link],%[Link])
)
API instead.

[Link] 22/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

Parameters

url Uri : This value cannot be null .

mode String : This value cannot be null .

Returns

ParcelFileDescriptor This value may be null .


(/reference/android/os/ParcelFileDescriptor)

Throws

FileNotFoundException
(/reference/java/io/FileNotFoundException)

RemoteException
(/reference/android/os/RemoteException)

openTypedAssetFileAdded in API level 29 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public final AssetFileDescriptor (/reference/android/content/res/AssetFileDescriptor) openT


String (/reference/java/lang/String) mimeTypeFilter,
Bundle (/reference/android/os/Bundle) opts,
CancellationSignal (/reference/android/os/CancellationSignal) signal)

Parameters

[Link] 23/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

uri Uri : This value cannot be null .

mimeTypeFilter String : This value cannot be null .

opts Bundle : This value may be null .

signal CancellationSignal : This value may be null .

Returns

AssetFileDescriptor This value may be null .


(/reference/android/content/res/AssetFileDescriptor)

Throws

FileNotFoundException
(/reference/java/io/FileNotFoundException)

RemoteException
(/reference/android/os/RemoteException)

openTypedAssetFileDescriptor
Added in API level 19 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public final AssetFileDescriptor (/reference/android/content/res/AssetFileDescriptor) openT


String (/reference/java/lang/String) mimeType,
Bundle (/reference/android/os/Bundle) opts,
CancellationSignal (/reference/android/os/CancellationSignal) signal)

[Link] 24/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

See [Link]
(/reference/android/content/ContentProvider#openTypedAssetFile([Link],%[Link]
g,%[Link]))

Parameters

uri Uri : This value cannot be null .

mimeType String : This value cannot be null .

opts Bundle : This value may be null .

signal CancellationSignal : This value may be null .

Returns

AssetFileDescriptor This value may be null .


(/reference/android/content/res/AssetFileDescriptor)

Throws

FileNotFoundException
(/reference/java/io/FileNotFoundException)

RemoteException
(/reference/android/os/RemoteException)

openTypedAssetFileDescriptor
Added in API level 11 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

[Link] 25/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

public final AssetFileDescriptor (/reference/android/content/res/AssetFileDescriptor) openT


String (/reference/java/lang/String) mimeType,
Bundle (/reference/android/os/Bundle) opts)

See [Link]
(/reference/android/content/ContentProvider#openTypedAssetFile([Link],%[Link]
g,%[Link]))

Parameters

uri Uri : This value cannot be null .

mimeType String : This value cannot be null .

opts Bundle : This value may be null .

Returns

AssetFileDescriptor This value may be null .


(/reference/android/content/res/AssetFileDescriptor)

Throws

FileNotFoundException
(/reference/java/io/FileNotFoundException)

RemoteException
(/reference/android/os/RemoteException)

[Link] 26/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

query Added in API level 26 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public Cursor (/reference/android/database/Cursor) query (Uri (/reference/android/net/Uri) uri


String[] (/reference/java/lang/String) projection,
Bundle (/reference/android/os/Bundle) queryArgs,
CancellationSignal (/reference/android/os/CancellationSignal) cancellati

See [Link]
(/reference/android/content/ContentProvider#query([Link],%[Link][],%20androi
[Link],%[Link]))

Parameters

uri Uri : This value cannot be null .

projection String : This value may be null .

queryArgs Bundle

cancellationSignal CancellationSignal : This value may be null .

Returns

Cursor This value may be null .


(/reference/android/database/Cursor)

Throws

[Link] 27/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

RemoteException
(/reference/android/os/RemoteException)

query Added in API level 16 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public Cursor (/reference/android/database/Cursor) query (Uri (/reference/android/net/Uri) uri


String[] (/reference/java/lang/String) projection,
String (/reference/java/lang/String) selection,
String[] (/reference/java/lang/String) selectionArgs,
String (/reference/java/lang/String) sortOrder,
CancellationSignal (/reference/android/os/CancellationSignal) cancellati

See [Link]
(/reference/android/content/ContentProvider#query([Link],%[Link][],%20androi
[Link],%[Link]))

Parameters

uri Uri : This value cannot be null .

projection String : This value may be null .

selection String : This value may be null .

selectionArgs String : This value may be null .

sortOrder String : This value may be null .

cancellationSignal CancellationSignal : This value may be null .

[Link] 28/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

Returns

Cursor This value may be null .


(/reference/android/database/Cursor)

Throws

RemoteException
(/reference/android/os/RemoteException)

query Added in API level 5 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public Cursor (/reference/android/database/Cursor) query (Uri (/reference/android/net/Uri) url


String[] (/reference/java/lang/String) projection,
String (/reference/java/lang/String) selection,
String[] (/reference/java/lang/String) selectionArgs,
String (/reference/java/lang/String) sortOrder)

See [Link]
(/reference/android/content/ContentProvider#query([Link],%[Link][],%20androi
[Link],%[Link]))

Parameters

url Uri : This value cannot be null .

projection String : This value may be null .

selection String : This value may be null .

[Link] 29/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

selectionArgs String : This value may be null .

sortOrder String : This value may be null .

Returns

Cursor This value may be null .


(/reference/android/database/Cursor)

Throws

RemoteException
(/reference/android/os/RemoteException)

refresh Added in API level 26 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public boolean refresh (Uri (/reference/android/net/Uri) url,


Bundle (/reference/android/os/Bundle) extras,
CancellationSignal (/reference/android/os/CancellationSignal) cancellati

See [Link]
(/reference/android/content/ContentProvider#refresh([Link],%[Link],%20andr
[Link]))

Parameters

url Uri

[Link] 30/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

extras Bundle : This value may be null .

cancellationSignal CancellationSignal : This value may be null .

Returns

boolean

Throws

RemoteException
(/reference/android/os/RemoteException)

release Added in API level 5 (/guide/topics/manifest/uses-sdk-element#ApiLevels)


Deprecated in API level 24 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public boolean release ()

This method was deprecated in API level 24.


replaced by close() (/reference/android/content/ContentProviderClient#close()).

Returns

boolean

uncanonicalize Added in API level 19 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

[Link] 31/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

public final Uri (/reference/android/net/Uri) uncanonicalize (Uri (/reference/android/net/Ur

See [Link]
(/reference/android/content/ContentProvider#uncanonicalize([Link]))

Parameters

url Uri : This value cannot be null .

Returns

Uri (/reference/android/net/Uri) This value may be null .

Throws

RemoteException
(/reference/android/os/RemoteException)

update Added in API level 30 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public int update (Uri (/reference/android/net/Uri) url,


ContentValues (/reference/android/content/ContentValues) values,
Bundle (/reference/android/os/Bundle) extras)

See [Link]
(/reference/android/content/ContentProvider#update([Link],%[Link]
ues,%[Link]))

[Link] 32/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

Parameters

url Uri : This value cannot be null .

values ContentValues : This value may be null .

extras Bundle : This value may be null .

Returns

int

Throws

RemoteException
(/reference/android/os/RemoteException)

update Added in API level 5 (/guide/topics/manifest/uses-sdk-element#ApiLevels)

public int update (Uri (/reference/android/net/Uri) url,


ContentValues (/reference/android/content/ContentValues) values,
String (/reference/java/lang/String) selection,
String[] (/reference/java/lang/String) selectionArgs)

See [Link]
(/reference/android/content/ContentProvider#update([Link],%[Link]
ues,%[Link]))

[Link] 33/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

Parameters

url Uri : This value cannot be null .

values ContentValues : This value may be null .

selection String : This value may be null .

selectionArgs String : This value may be null .

Returns

int

Throws

RemoteException
(/reference/android/os/RemoteException)

Protected methods

finalize Added in API level 5 (/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

[Link] 34/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

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.

Throws

Throwable
(/reference/java/lang/Throwable)

Content and code samples on this page are subject to the licenses described in the Content License
(/license). Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2025-02-10 UTC.

[Link] 35/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers

[Link] 36/36

You might also like