ContentProviderClient - API Reference - Android Developers
ContentProviderClient - API Reference - Android Developers
ProviderClient
Kotlin (/reference/kotlin/android/content/ContentProviderClient) | Java
[Link] (/reference/java/lang/Object)
↳ [Link]
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
[Link] 2/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers
[Link] 3/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers
See [Link]
See [Link]
[Link] 4/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers
Protected methods
Called by the garbage collector on an object when garbage collection determines that there are
no more references to the object.
Inherited methods
boolean equals
(/reference/java/lang/Object#equals([Link])
[Link] 5/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers
[Link] 6/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers
Public methods
See [Link]
(/reference/android/content/ContentProvider#applyBatch([Link],%[Link]<andr
[Link]>))
Parameters
Returns
[Link] 7/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers
Throws
OperationApplicationException
(/reference/android/content/OperationApplicationException)
RemoteException
(/reference/android/os/RemoteException)
See [Link]
(/reference/android/content/ContentProvider#applyBatch([Link],%[Link]<andr
[Link]>))
Parameters
Returns
[Link] 8/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers
Throws
OperationApplicationException
(/reference/android/content/OperationApplicationException)
RemoteException
(/reference/android/os/RemoteException)
See [Link]
(/reference/android/content/ContentProvider#bulkInsert([Link],%[Link]
Values[]))
Parameters
Returns
[Link] 9/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers
int
Throws
RemoteException
(/reference/android/os/RemoteException)
Parameters
[Link] 10/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers
Returns
Throws
RemoteException
(/reference/android/os/RemoteException)
Parameters
[Link] 11/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers
Returns
Throws
RemoteException
(/reference/android/os/RemoteException)
See [Link]
(/reference/android/content/ContentProvider#canonicalize([Link]))
Parameters
Returns
Throws
[Link] 12/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers
RemoteException
(/reference/android/os/RemoteException)
Closes this client connection, indicating to the system that the underlying
ContentProvider (/reference/android/content/ContentProvider) is no longer needed.
See [Link]
(/reference/android/content/ContentProvider#delete([Link],%[Link]))
Parameters
[Link] 13/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers
Returns
int
Throws
RemoteException
(/reference/android/os/RemoteException)
See [Link]
(/reference/android/content/ContentProvider#delete([Link],%[Link]))
Parameters
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)
Returns
See [Link]
(/reference/android/content/ContentProvider#getStreamTypes([Link],%[Link]))
[Link] 15/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers
Parameters
Returns
Throws
RemoteException
(/reference/android/os/RemoteException)
See [Link]
(/reference/android/content/ContentProvider#getType([Link]))
Parameters
[Link] 16/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers
Returns
Throws
RemoteException
(/reference/android/os/RemoteException)
See [Link]
(/reference/android/content/ContentProvider#insert([Link],%[Link]
es))
Parameters
[Link] 17/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers
Returns
Throws
RemoteException
(/reference/android/os/RemoteException)
See [Link]
(/reference/android/content/ContentProvider#insert([Link],%[Link]
es))
Parameters
Returns
[Link] 18/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers
Throws
RemoteException
(/reference/android/os/RemoteException)
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
Returns
[Link] 19/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers
Throws
FileNotFoundException
(/reference/java/io/FileNotFoundException)
RemoteException
(/reference/android/os/RemoteException)
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
[Link] 20/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers
Returns
Throws
FileNotFoundException
(/reference/java/io/FileNotFoundException)
RemoteException
(/reference/android/os/RemoteException)
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
[Link] 21/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers
Returns
Throws
FileNotFoundException
(/reference/java/io/FileNotFoundException)
RemoteException
(/reference/android/os/RemoteException)
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
Returns
Throws
FileNotFoundException
(/reference/java/io/FileNotFoundException)
RemoteException
(/reference/android/os/RemoteException)
Parameters
[Link] 23/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers
Returns
Throws
FileNotFoundException
(/reference/java/io/FileNotFoundException)
RemoteException
(/reference/android/os/RemoteException)
openTypedAssetFileDescriptor
Added in API level 19 (/guide/topics/manifest/uses-sdk-element#ApiLevels)
[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
Returns
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
See [Link]
(/reference/android/content/ContentProvider#openTypedAssetFile([Link],%[Link]
g,%[Link]))
Parameters
Returns
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
See [Link]
(/reference/android/content/ContentProvider#query([Link],%[Link][],%20androi
[Link],%[Link]))
Parameters
queryArgs Bundle
Returns
Throws
[Link] 27/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers
RemoteException
(/reference/android/os/RemoteException)
See [Link]
(/reference/android/content/ContentProvider#query([Link],%[Link][],%20androi
[Link],%[Link]))
Parameters
[Link] 28/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers
Returns
Throws
RemoteException
(/reference/android/os/RemoteException)
See [Link]
(/reference/android/content/ContentProvider#query([Link],%[Link][],%20androi
[Link],%[Link]))
Parameters
[Link] 29/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers
Returns
Throws
RemoteException
(/reference/android/os/RemoteException)
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
Returns
boolean
Throws
RemoteException
(/reference/android/os/RemoteException)
Returns
boolean
[Link] 31/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers
See [Link]
(/reference/android/content/ContentProvider#uncanonicalize([Link]))
Parameters
Returns
Throws
RemoteException
(/reference/android/os/RemoteException)
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
Returns
int
Throws
RemoteException
(/reference/android/os/RemoteException)
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
Returns
int
Throws
RemoteException
(/reference/android/os/RemoteException)
Protected methods
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
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.
[Link] 35/36
2/15/26, 8:49 PM ContentProviderClient | API reference | Android Developers
[Link] 36/36