ContentProviderClient
open class ContentProviderClient : AutoCloseable
| kotlin.Any | |
| ↳ | android.content.ContentProviderClient |
The public interface object used to interact with a specific ContentProvider.
Instances can be obtained by calling ContentResolver#acquireContentProviderClient or ContentResolver#acquireUnstableContentProviderClient. Instances must be released using close() in order to indicate to the system that the underlying 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, the methods here such as query and openFile are not thread safe -- you must not call close() on the ContentProviderClient those calls are made from until you are finished with the data they have returned.
Summary
Protected methods |
|
|---|---|
| open Unit |
finalize() |
Public methods
applyBatch
open fun applyBatch(operations: ArrayList<ContentProviderOperation!>): Array<ContentProviderResult!>
See ContentProvider#applyBatch
| Parameters | |
|---|---|
operations |
ArrayList<ContentProviderOperation!>: This value cannot be null. |
| Return | |
|---|---|
Array<ContentProviderResult!> |
This value cannot be null. |
applyBatch
open fun applyBatch(
authority: String,
operations: ArrayList<ContentProviderOperation!>
): Array<ContentProviderResult!>
See ContentProvider#applyBatch
| Parameters | |
|---|---|
authority |
String: This value cannot be null. |
operations |
ArrayList<ContentProviderOperation!>: This value cannot be null. |
| Return | |
|---|---|
Array<ContentProviderResult!> |
This value cannot be null. |
bulkInsert
open fun bulkInsert(
url: Uri,
initialValues: Array<ContentValues!>
): Int
See ContentProvider#bulkInsert
| Parameters | |
|---|---|
url |
Uri: This value cannot be null. |
initialValues |
Array<ContentValues!>: This value cannot be null. |
call
open fun call(
method: String,
arg: String?,
extras: Bundle?
): Bundle?
See ContentProvider#call(String, String, Bundle)
| Parameters | |
|---|---|
method |
String: This value cannot be null. |
arg |
String?: This value may be null. |
extras |
Bundle?: This value may be null. |
| Return | |
|---|---|
Bundle? |
This value may be null. |
call
open fun call(
authority: String,
method: String,
arg: String?,
extras: Bundle?
): Bundle?
See ContentProvider#call(String, String, 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. |
| Return | |
|---|---|
Bundle? |
This value may be null. |
canonicalize
fun canonicalize(url: Uri): Uri?
See ContentProvider#canonicalize
| Parameters | |
|---|---|
url |
Uri: This value cannot be null. |
| Return | |
|---|---|
Uri? |
This value may be null. |
close
open fun close(): Unit
Closes this client connection, indicating to the system that the underlying ContentProvider is no longer needed.
| Exceptions | |
|---|---|
java.lang.Exception |
if this resource cannot be closed |
delete
open fun delete(
url: Uri,
selection: String?,
selectionArgs: Array<String!>?
): Int
| Parameters | |
|---|---|
url |
Uri: This value cannot be null. |
selection |
String?: This value may be null. |
selectionArgs |
Array<String!>?: This value may be null. |
delete
open fun delete(
url: Uri,
extras: Bundle?
): Int
| Parameters | |
|---|---|
url |
Uri: This value cannot be null. |
extras |
Bundle?: This value may be null. |
getLocalContentProvider
open fun getLocalContentProvider(): ContentProvider?
Get a reference to the ContentProvider that is associated with this client. If the 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.
| Return | |
|---|---|
ContentProvider? |
If the associated ContentProvider is local, returns it. Otherwise returns null. |
getStreamTypes
open fun getStreamTypes(
url: Uri,
mimeTypeFilter: String
): Array<String!>?
See ContentProvider#getStreamTypes
| Parameters | |
|---|---|
url |
Uri: This value cannot be null. |
mimeTypeFilter |
String: This value cannot be null. |
| Return | |
|---|---|
Array<String!>? |
This value may be null. |
getType
open fun getType(url: Uri): String?
| Parameters | |
|---|---|
url |
Uri: This value cannot be null. |
| Return | |
|---|---|
String? |
This value may be null. |
insert
open fun insert(
url: Uri,
initialValues: ContentValues?
): Uri?
| Parameters | |
|---|---|
url |
Uri: This value cannot be null. |
initialValues |
ContentValues?: This value may be null. |
| Return | |
|---|---|
Uri? |
This value may be null. |
insert
open fun insert(
url: Uri,
initialValues: ContentValues?,
extras: Bundle?
): Uri?
| Parameters | |
|---|---|
url |
Uri: This value cannot be null. |
initialValues |
ContentValues?: This value may be null. |
extras |
Bundle?: This value may be null. |
| Return | |
|---|---|
Uri? |
This value may be null. |
openAssetFile
open fun openAssetFile(
url: Uri,
mode: String
): AssetFileDescriptor?
See ContentProvider#openAssetFile. Note that this does not take care of non-content: URIs such as file:. It is strongly recommended you use the ContentResolver#openAssetFileDescriptor API instead.
| Parameters | |
|---|---|
url |
Uri: This value cannot be null. |
mode |
String: This value cannot be null. |
| Return | |
|---|---|
AssetFileDescriptor? |
This value may be null. |
openAssetFile
open fun openAssetFile(
url: Uri,
mode: String,
signal: CancellationSignal?
): AssetFileDescriptor?
See ContentProvider#openAssetFile. Note that this does not take care of non-content: URIs such as file:. It is strongly recommended you use the ContentResolver#openAssetFileDescriptor API instead.
| Parameters | |
|---|---|
url |
Uri: This value cannot be null. |
mode |
String: This value cannot be null. |
signal |
CancellationSignal?: This value may be null. |
| Return | |
|---|---|
AssetFileDescriptor? |
This value may be null. |
openFile
open fun openFile(
url: Uri,
mode: String
): ParcelFileDescriptor?
See ContentProvider#openFile. Note that this does not take care of non-content: URIs such as file:. It is strongly recommended you use the ContentResolver#openFileDescriptor API instead.
| Parameters | |
|---|---|
url |
Uri: This value cannot be null. |
mode |
String: This value cannot be null. |
| Return | |
|---|---|
ParcelFileDescriptor? |
This value may be null. |
openFile
open fun openFile(
url: Uri,
mode: String,
signal: CancellationSignal?
): ParcelFileDescriptor?
See ContentProvider#openFile. Note that this does not take care of non-content: URIs such as file:. It is strongly recommended you use the ContentResolver#openFileDescriptor API instead.
| Parameters | |
|---|---|
url |
Uri: This value cannot be null. |
mode |
String: This value cannot be null. |
signal |
CancellationSignal?: This value may be null. |
| Return | |
|---|---|
ParcelFileDescriptor? |
This value may be null. |
openTypedAssetFile
fun openTypedAssetFile(
uri: Uri,
mimeTypeFilter: String,
opts: Bundle?,
signal: CancellationSignal?
): AssetFileDescriptor?
| Parameters | |
|---|---|
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. |
| Return | |
|---|---|
AssetFileDescriptor? |
This value may be null. |
openTypedAssetFileDescriptor
fun openTypedAssetFileDescriptor(
uri: Uri,
mimeType: String,
opts: Bundle?
): AssetFileDescriptor?
See ContentProvider#openTypedAssetFile
| Parameters | |
|---|---|
uri |
Uri: This value cannot be null. |
mimeType |
String: This value cannot be null. |
opts |
Bundle?: This value may be null. |
| Return | |
|---|---|
AssetFileDescriptor? |
This value may be null. |
openTypedAssetFileDescriptor
fun openTypedAssetFileDescriptor(
uri: Uri,
mimeType: String,
opts: Bundle?,
signal: CancellationSignal?
): AssetFileDescriptor?
See ContentProvider#openTypedAssetFile
| 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. |
| Return | |
|---|---|
AssetFileDescriptor? |
This value may be null. |
query
open fun query(
url: Uri,
projection: Array<String!>?,
selection: String?,
selectionArgs: Array<String!>?,
sortOrder: String?
): Cursor?
| Parameters | |
|---|---|
url |
Uri: This value cannot be null. |
projection |
Array<String!>?: This value may be null. |
selection |
String?: This value may be null. |
selectionArgs |
Array<String!>?: This value may be null. |
sortOrder |
String?: This value may be null. |
| Return | |
|---|---|
Cursor? |
This value may be null. |
query
open fun query(
uri: Uri,
projection: Array<String!>?,
selection: String?,
selectionArgs: Array<String!>?,
sortOrder: String?,
cancellationSignal: CancellationSignal?
): Cursor?
| Parameters | |
|---|---|
uri |
Uri: This value cannot be null. |
projection |
Array<String!>?: This value may be null. |
selection |
String?: This value may be null. |
selectionArgs |
Array<String!>?: This value may be null. |
sortOrder |
String?: This value may be null. |
cancellationSignal |
CancellationSignal?: This value may be null. |
| Return | |
|---|---|
Cursor? |
This value may be null. |
query
open fun query(
uri: Uri,
projection: Array<String!>?,
queryArgs: Bundle!,
cancellationSignal: CancellationSignal?
): Cursor?
| Parameters | |
|---|---|
uri |
Uri: This value cannot be null. |
projection |
Array<String!>?: This value may be null. |
cancellationSignal |
CancellationSignal?: This value may be null. |
| Return | |
|---|---|
Cursor? |
This value may be null. |
refresh
open fun refresh(
url: Uri!,
extras: Bundle?,
cancellationSignal: CancellationSignal?
): Boolean
| Parameters | |
|---|---|
extras |
Bundle?: This value may be null. |
cancellationSignal |
CancellationSignal?: This value may be null. |
uncanonicalize
fun uncanonicalize(url: Uri): Uri?
See ContentProvider#uncanonicalize
| Parameters | |
|---|---|
url |
Uri: This value cannot be null. |
| Return | |
|---|---|
Uri? |
This value may be null. |
update
open fun update(
url: Uri,
values: ContentValues?,
selection: String?,
selectionArgs: Array<String!>?
): Int
| Parameters | |
|---|---|
url |
Uri: This value cannot be null. |
values |
ContentValues?: This value may be null. |
selection |
String?: This value may be null. |
selectionArgs |
Array<String!>?: This value may be null. |
update
open fun update(
url: Uri,
values: ContentValues?,
extras: Bundle?
): Int
| Parameters | |
|---|---|
url |
Uri: This value cannot be null. |
values |
ContentValues?: This value may be null. |
extras |
Bundle?: This value may be null. |
Protected methods
finalize
protected open fun finalize(): Unit
| Exceptions | |
|---|---|
java.lang.Throwable |
the Exception raised by this method |