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 android.content.ContentResolver#acquireContentProviderClient or android.content.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
Public methods | |
---|---|
open Array<ContentProviderResult!> |
applyBatch(authority: String, operations: ArrayList<ContentProviderOperation!>) See android. |
open Array<ContentProviderResult!> |
applyBatch(operations: ArrayList<ContentProviderOperation!>) See android. |
open Int |
bulkInsert(url: Uri, initialValues: Array<ContentValues!>) |
open Bundle? | |
open Bundle? | |
Uri? |
canonicalize(url: Uri) |
open Unit |
close() Closes this client connection, indicating to the system that the underlying |
open Int |
See android. |
open Int |
See android. |
open ContentProvider? |
Get a reference to the |
open Array<String!>? |
getStreamTypes(url: Uri, mimeTypeFilter: String) |
open String? | |
open Uri? |
insert(url: Uri, initialValues: ContentValues?) See android. |
open Uri? |
insert(url: Uri, initialValues: ContentValues?, extras: Bundle?) See android. |
open AssetFileDescriptor? |
openAssetFile(url: Uri, mode: String) See android. |
open AssetFileDescriptor? |
openAssetFile(url: Uri, mode: String, signal: CancellationSignal?) See android. |
open ParcelFileDescriptor? |
See android. |
open ParcelFileDescriptor? |
openFile(url: Uri, mode: String, signal: CancellationSignal?) See android. |
AssetFileDescriptor? |
openTypedAssetFile(uri: Uri, mimeTypeFilter: String, opts: Bundle?, signal: CancellationSignal?) |
AssetFileDescriptor? |
openTypedAssetFileDescriptor(uri: Uri, mimeType: String, opts: Bundle?) See android. |
AssetFileDescriptor? |
openTypedAssetFileDescriptor(uri: Uri, mimeType: String, opts: Bundle?, signal: CancellationSignal?) See android. |
open Cursor? |
query(uri: Uri, projection: Array<String!>?, queryArgs: Bundle!, cancellationSignal: CancellationSignal?) See android. |
open Cursor? |
query(url: Uri, projection: Array<String!>?, selection: String?, selectionArgs: Array<String!>?, sortOrder: String?) See android. |
open Cursor? |
query(uri: Uri, projection: Array<String!>?, selection: String?, selectionArgs: Array<String!>?, sortOrder: String?, cancellationSignal: CancellationSignal?) See android. |
open Boolean |
refresh(url: Uri!, extras: Bundle?, cancellationSignal: CancellationSignal?) |
open Boolean |
release() |
Uri? |
uncanonicalize(url: Uri) |
open Int |
update(url: Uri, values: ContentValues?, extras: Bundle?) See android. |
open Int |
See android. |
Protected methods | |
---|---|
open Unit |
finalize() |
Public methods
applyBatch
open fun applyBatch(
authority: String,
operations: ArrayList<ContentProviderOperation!>
): Array<ContentProviderResult!>
See android.content.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 . |
applyBatch
open fun applyBatch(operations: ArrayList<ContentProviderOperation!>): Array<ContentProviderResult!>
See android.content.ContentProvider#applyBatch
Parameters | |
---|---|
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,
extras: Bundle?
): Int
See android.content.ContentProvider#delete
Parameters | |
---|---|
url |
Uri: This value cannot be null . |
extras |
Bundle?: This value may be null . |
delete
open fun delete(
url: Uri,
selection: String?,
selectionArgs: Array<String!>?
): Int
See android.content.ContentProvider#delete
Parameters | |
---|---|
url |
Uri: This value cannot be null . |
selection |
String?: This value may be null . |
selectionArgs |
Array<String!>?: 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?
See android.content.ContentProvider#insert
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?
See android.content.ContentProvider#insert
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 android.content.ContentProvider#openAssetFile. Note that this does not take care of non-content: URIs such as file:. It is strongly recommended you use the android.content.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 android.content.ContentProvider#openAssetFile. Note that this does not take care of non-content: URIs such as file:. It is strongly recommended you use the android.content.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 android.content.ContentProvider#openFile. Note that this does not take care of non-content: URIs such as file:. It is strongly recommended you use the android.content.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 android.content.ContentProvider#openFile. Note that this does not take care of non-content: URIs such as file:. It is strongly recommended you use the android.content.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 android.content.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 android.content.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(
uri: Uri,
projection: Array<String!>?,
queryArgs: Bundle!,
cancellationSignal: CancellationSignal?
): Cursor?
See android.content.ContentProvider#query
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 . |
query
open fun query(
url: Uri,
projection: Array<String!>?,
selection: String?,
selectionArgs: Array<String!>?,
sortOrder: String?
): Cursor?
See android.content.ContentProvider#query
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?
See android.content.ContentProvider#query
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 . |
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?,
extras: Bundle?
): Int
See android.content.ContentProvider#update
Parameters | |
---|---|
url |
Uri: This value cannot be null . |
values |
ContentValues?: This value may be null . |
extras |
Bundle?: This value may be null . |
update
open fun update(
url: Uri,
values: ContentValues?,
selection: String?,
selectionArgs: Array<String!>?
): Int
See android.content.ContentProvider#update
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 . |
Protected methods
finalize
protected open fun finalize(): Unit
Exceptions | |
---|---|
java.lang.Throwable |
the Exception raised by this method |