Most visited

Recently visited

Added in API level 19

DocumentsProvider

public abstract class DocumentsProvider
extends ContentProvider

java.lang.Object
   ↳ android.content.ContentProvider
     ↳ android.provider.DocumentsProvider


文档提供者的基类。 文档提供者提供对持久文件(例如存储在本地磁盘上的文件或云存储服务中的文件)的读取和写入访问权限。 要创建文档提供者,请扩展此类,实现抽象方法,并将其添加到您的清单中,如下所示:

<manifest>
    ...
    <application>
        ...
        <provider
            android:name="com.example.MyCloudProvider"
            android:authorities="com.example.mycloudprovider"
            android:exported="true"
            android:grantUriPermissions="true"
            android:permission="android.permission.MANAGE_DOCUMENTS"
            android:enabled="@bool/isAtLeastKitKat">
            <intent-filter>
                <action android:name="android.content.action.DOCUMENTS_PROVIDER" />
            </intent-filter>
        </provider>
        ...
    </application>
</manifest>

在定义提供者时,必须使用MANAGE_DOCUMENTS来保护它,这是系统可以获得的权限。 应用程序不能直接使用文档提供程序; 他们必须通过ACTION_OPEN_DOCUMENTACTION_CREATE_DOCUMENT ,这需要用户主动导航和选择文档。 当用户通过该UI选择文档时,系统向请求的应用程序发布狭窄的URI许可授权。

Documents

文档可以是可打开的流(具有特定的MIME类型),也可以是包含其他文档(使用MIME_TYPE_DIR MIME类型)的目录。 每个目录代表包含零个或多个文档的子树的顶部,它们可以递归地包含更多的文档和目录。

每个文档都可以具有不同的功能,如COLUMN_FLAGS 例如,如果文档可以表示为缩略图,则您的提供商可以设置FLAG_SUPPORTS_THUMBNAIL并实现openDocumentThumbnail(String, Point, CancellationSignal)以返回该缩略图。

提供者下的每个文档都被它的COLUMN_DOCUMENT_ID唯一引用,它一旦返回就不能改变。 响应queryChildDocuments(String, String[], String)时,单个文档可以包含在多个目录中。 例如,提供商可能会在多个位置显示一张照片:一次位于地理位置目录中,另一张位于日期目录中。

Roots

所有文件都通过一个或多个“根”出现。 每个根代表用户可以导航的文档树的顶部。 例如,根可以表示一个帐户或一个物理存储设备。 与文档类似,每个根可以具有通过COLUMN_FLAGS表达的能力。

也可以看看:

Summary

Inherited constants

From interface android.content.ComponentCallbacks2

Public constructors

DocumentsProvider()

Public methods

void attachInfo(Context context, ProviderInfo info)

实现由父类提供。

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

实现由父类提供。

Uri canonicalize(Uri uri)

实现由父类提供。

String copyDocument(String sourceDocumentId, String targetParentDocumentId)

复制请求的文档或文档树。

String createDocument(String parentDocumentId, String mimeType, String displayName)

创建一个新文档并返回其新生成的 COLUMN_DOCUMENT_ID

final int delete(Uri uri, String selection, String[] selectionArgs)

实现由父类提供。

void deleteDocument(String documentId)

删除所请求的文件。

String[] getDocumentStreamTypes(String documentId, String mimeTypeFilter)

返回与过滤器匹配的流式MIME类型列表,该列表可以传递给 openTypedDocument(String, String, Bundle, CancellationSignal)

String getDocumentType(String documentId)

返回请求文档的具体MIME类型。

String[] getStreamTypes(Uri uri, String mimeTypeFilter)

由客户端调用以确定此内容提供程序支持给定URI的数据流的类型。

final String getType(Uri uri)

实现由父类提供。

final Uri insert(Uri uri, ContentValues values)

实现由父类提供。

boolean isChildDocument(String parentDocumentId, String documentId)

测试文档是否来自给定父项的后代(子项,孙项等)。

String moveDocument(String sourceDocumentId, String sourceParentDocumentId, String targetParentDocumentId)

移动请求的文档或文档树。

final AssetFileDescriptor openAssetFile(Uri uri, String mode, CancellationSignal signal)

实现由父类提供。

final AssetFileDescriptor openAssetFile(Uri uri, String mode)

实现由父类提供。

abstract ParcelFileDescriptor openDocument(String documentId, String mode, CancellationSignal signal)

打开并返回请求的文件。

AssetFileDescriptor openDocumentThumbnail(String documentId, Point sizeHint, CancellationSignal signal)

打开并返回所请求文档的缩略图。

final ParcelFileDescriptor openFile(Uri uri, String mode, CancellationSignal signal)

实现由父类提供。

final ParcelFileDescriptor openFile(Uri uri, String mode)

实现由父类提供。

final AssetFileDescriptor openTypedAssetFile(Uri uri, String mimeTypeFilter, Bundle opts)

实现由父类提供。

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

实现由父类提供。

AssetFileDescriptor openTypedDocument(String documentId, String mimeTypeFilter, Bundle opts, CancellationSignal signal)

以与指定的MIME类型过滤器匹配的格式打开并返回文档。

final Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder)

实现由父类提供。

abstract Cursor queryChildDocuments(String parentDocumentId, String[] projection, String sortOrder)

返回请求的目录中包含的子文档。

abstract Cursor queryDocument(String documentId, String[] projection)

返回单个请求文档的元数据。

Cursor queryRecentDocuments(String rootId, String[] projection)

根据请求的根目录返回最近修改的文档。

abstract Cursor queryRoots(String[] projection)

返回当前提供的所有根。

Cursor querySearchDocuments(String rootId, String query, String[] projection)

在请求的根目录下返回与给定查询匹配的文档。

void removeDocument(String documentId, String parentDocumentId)

删除请求的文档或文档树。

String renameDocument(String documentId, String displayName)

重命名现有文档。

final void revokeDocumentPermission(String documentId)

撤销给定的 COLUMN_DOCUMENT_ID任何活动权限授予,通常在文档无效时调用。

final int update(Uri uri, ContentValues values, String selection, String[] selectionArgs)

实现由父类提供。

Inherited methods

From class android.content.ContentProvider
From class java.lang.Object
From interface android.content.ComponentCallbacks2
From interface android.content.ComponentCallbacks

Public constructors

DocumentsProvider

Added in API level 19
DocumentsProvider ()

Public methods

attachInfo

Added in API level 19
void attachInfo (Context context, 
                ProviderInfo info)

实现由父类提供。

Parameters
context Context: The context this provider is running in
info ProviderInfo: Registered information about this content provider

call

Added in API level 19
Bundle call (String method, 
                String arg, 
                Bundle extras)

实现由父类提供。 可以重写以提供附加功能,但子类必须始终调用超类。 如果超类返回null ,则该子类可以实现自定义行为。

Parameters
method String: method name to call. Opaque to framework, but should not be null.
arg String: provider-defined String argument. May be null.
extras Bundle: provider-defined Bundle argument. May be null.
Returns
Bundle provider-defined return value. May be null, which is also the default for providers which don't implement any call methods.

canonicalize

Added in API level 19
Uri canonicalize (Uri uri)

实现由父类提供。 可以重写以提供附加功能,但子类必须始终调用超类。 如果超类返回null ,则该子类可以实现自定义行为。

这通常用于将子树URI解析为具体的文档引用,并沿途发布较窄的单文档URI许可授权。

Parameters
uri Uri: The Uri to canonicalize.
Returns
Uri Return the canonical representation of url, or null if canonicalization of that Uri is not supported.

也可以看看:

copyDocument

Added in API level 24
String copyDocument (String sourceDocumentId, 
                String targetParentDocumentId)

复制请求的文档或文档树。

将包含所有子文档的文档复制到同一文档提供程序中的另一个位置。 完成后,返回目标目标处复制文档的文档ID。 绝不能退还null

Parameters
sourceDocumentId String: the document to copy.
targetParentDocumentId String: the target document to be copied into as a child.
Returns
String
Throws
FileNotFoundException

createDocument

Added in API level 19
String createDocument (String parentDocumentId, 
                String mimeType, 
                String displayName)

创建一个新文档并返回其新生成的COLUMN_DOCUMENT_ID 您必须分配一个新的COLUMN_DOCUMENT_ID来表示文档,一旦返回,该文档不得更改。

Parameters
parentDocumentId String: the parent directory to create the new document under.
mimeType String: the concrete MIME type associated with the new document. If the MIME type is not supported, the provider must throw.
displayName String: the display name of the new document. The provider may alter this name to meet any internal constraints, such as avoiding conflicting names.
Returns
String
Throws
FileNotFoundException

delete

Added in API level 19
int delete (Uri uri, 
                String selection, 
                String[] selectionArgs)

实现由父类提供。 默认引发,不能被重写。

Parameters
uri Uri: The full URI to query, including a row ID (if a specific record is requested).
selection String: An optional restriction to apply to rows when deleting.
selectionArgs String
Returns
int The number of rows affected.

也可以看看:

deleteDocument

Added in API level 19
void deleteDocument (String documentId)

删除所请求的文件。

返回时,给定文档的任何URI权限授予都将被撤销。 如果作为此调用的副作用(如目录中的文档)删除了其他文档,则实现者负责使用revokeDocumentPermission(String)撤消这些权限。

Parameters
documentId String: the document to delete.
Throws
FileNotFoundException

getDocumentStreamTypes

Added in API level 24
String[] getDocumentStreamTypes (String documentId, 
                String mimeTypeFilter)

返回与过滤器匹配的流式MIME类型列表,该列表可以传递给 openTypedDocument(String, String, Bundle, CancellationSignal)

默认实现返回一个由 queryDocument(String, String[])提供的MIME类型,只要它与筛选器匹配并且文档没有设置 FLAG_VIRTUAL_DOCUMENT标志。

Parameters
documentId String
mimeTypeFilter String
Returns
String[]

也可以看看:

getDocumentType

Added in API level 19
String getDocumentType (String documentId)

返回请求文档的具体MIME类型。 必须与此文档的值COLUMN_MIME_TYPE匹配。 默认实现查询queryDocument(String, String[]) ,因此提供者可以选择将其作为优化覆盖。

Parameters
documentId String
Returns
String
Throws
FileNotFoundException

getStreamTypes

Added in API level 19
String[] getStreamTypes (Uri uri, 
                String mimeTypeFilter)

由客户端调用以确定此内容提供程序支持给定URI的数据流的类型。

重写此方法已弃用。 改为改写openTypedDocument(String, String, Bundle, CancellationSignal)

Parameters
uri Uri: The data in the content provider being queried.
mimeTypeFilter String: The type of data the client desires. May be a pattern, such as */* to retrieve all possible data types.
Returns
String[] Returns null if there are no possible data streams for the given mimeTypeFilter. Otherwise returns an array of all available concrete MIME types.

也可以看看:

getType

Added in API level 19
String getType (Uri uri)

实现由父类提供。 不能被重写。

Parameters
uri Uri: the URI to query.
Returns
String a MIME type string, or null if there is no type.

也可以看看:

insert

Added in API level 19
Uri insert (Uri uri, 
                ContentValues values)

实现由父类提供。 默认引发,不能被重写。

Parameters
uri Uri: The content:// URI of the insertion request. This must not be null.
values ContentValues: A set of column_name/value pairs to add to the database. This must not be null.
Returns
Uri The URI for the newly inserted item.

也可以看看:

isChildDocument

Added in API level 21
boolean isChildDocument (String parentDocumentId, 
                String documentId)

测试文档是否来自给定父项的后代(子项,孙项等)。 例如,提供商必须实现这个以支持ACTION_OPEN_DOCUMENT_TREE 您应该避免发出网络请求来快速保留此请求。

Parameters
parentDocumentId String: parent to verify against.
documentId String: child to verify.
Returns
boolean if given document is a descendant of the given parent.

也可以看看:

moveDocument

Added in API level 24
String moveDocument (String sourceDocumentId, 
                String sourceParentDocumentId, 
                String targetParentDocumentId)

移动请求的文档或文档树。

将包含所有子文档的文档移动到同一文档提供程序中的另一个位置。 完成后,返回目标目标处复制文档的文档ID。 绝不能退还null

如果文档不再可以使用 sourceDocumentId访问,则提供者有责任撤销授予。

Parameters
sourceDocumentId String: the document to move.
sourceParentDocumentId String: the parent of the document to move.
targetParentDocumentId String: the target document to be a new parent of the source document.
Returns
String
Throws
FileNotFoundException

openAssetFile

Added in API level 19
AssetFileDescriptor openAssetFile (Uri uri, 
                String mode, 
                CancellationSignal signal)

实现由父类提供。 不能被重写。

Parameters
uri Uri: The URI whose file is to be opened.
mode String: Access mode for the file. May be "r" for read-only access, "w" for write-only access (erasing whatever data is currently in the file), "wa" for write-only access to append to any existing data, "rw" for read and write access on any existing data, and "rwt" for read and write access that truncates any existing file.
signal CancellationSignal: A signal to cancel the operation in progress, or null if none. For example, if you are downloading a file from the network to service a "rw" mode request, you should periodically call throwIfCanceled() to check whether the client has canceled the request and abort the download.
Returns
AssetFileDescriptor Returns a new AssetFileDescriptor which you can use to access the file.
Throws
FileNotFoundException

也可以看看:

openAssetFile

Added in API level 19
AssetFileDescriptor openAssetFile (Uri uri, 
                String mode)

实现由父类提供。 不能被重写。

Parameters
uri Uri: The URI whose file is to be opened.
mode String: Access mode for the file. May be "r" for read-only access, "w" for write-only access (erasing whatever data is currently in the file), "wa" for write-only access to append to any existing data, "rw" for read and write access on any existing data, and "rwt" for read and write access that truncates any existing file.
Returns
AssetFileDescriptor Returns a new AssetFileDescriptor which you can use to access the file.
Throws
FileNotFoundException

也可以看看:

openDocument

Added in API level 19
ParcelFileDescriptor openDocument (String documentId, 
                String mode, 
                CancellationSignal signal)

打开并返回请求的文件。

您的提供商应该返回一个可靠的ParcelFileDescriptor来检测远程调用方读完或写入文档的时间。 如果模式为“r”或“w”,则可以返回管道或套接字对,但复杂模式(如“rw”)意味着支持查找的磁盘上的普通文件。

如果您在下载内容时阻止,则应定期检查 isCanceled()以放弃放弃的打开请求。

Parameters
documentId String: the document to return.
mode String: the mode to open with, such as 'r', 'w', or 'rw'.
signal CancellationSignal: used by the caller to signal if the request should be cancelled. May be null.
Returns
ParcelFileDescriptor
Throws
FileNotFoundException

也可以看看:

openDocumentThumbnail

Added in API level 19
AssetFileDescriptor openDocumentThumbnail (String documentId, 
                Point sizeHint, 
                CancellationSignal signal)

打开并返回所请求文档的缩略图。

提供者应该返回一个与提示大小紧密匹配的缩略图,如果可能的话,尝试从本地缓存中提供服务。 提供商不应该返回超过暗示尺寸两倍的图片。

如果执行昂贵的操作来下载或生成缩略图,则应定期检查 isCanceled()以放弃放弃的缩略图请求。

Parameters
documentId String: the document to return.
sizeHint Point: hint of the optimal thumbnail dimensions.
signal CancellationSignal: used by the caller to signal if the request should be cancelled. May be null.
Returns
AssetFileDescriptor
Throws
FileNotFoundException

也可以看看:

openFile

Added in API level 19
ParcelFileDescriptor openFile (Uri uri, 
                String mode, 
                CancellationSignal signal)

实现由父类提供。 不能被重写。

Parameters
uri Uri: The URI whose file is to be opened.
mode String: Access mode for the file. May be "r" for read-only access, "w" for write-only access, "rw" for read and write access, or "rwt" for read and write access that truncates any existing file.
signal CancellationSignal: A signal to cancel the operation in progress, or null if none. For example, if you are downloading a file from the network to service a "rw" mode request, you should periodically call throwIfCanceled() to check whether the client has canceled the request and abort the download.
Returns
ParcelFileDescriptor Returns a new ParcelFileDescriptor which you can use to access the file.
Throws
FileNotFoundException

也可以看看:

openFile

Added in API level 19
ParcelFileDescriptor openFile (Uri uri, 
                String mode)

实现由父类提供。 不能被重写。

Parameters
uri Uri: The URI whose file is to be opened.
mode String: Access mode for the file. May be "r" for read-only access, "rw" for read and write access, or "rwt" for read and write access that truncates any existing file.
Returns
ParcelFileDescriptor Returns a new ParcelFileDescriptor which you can use to access the file.
Throws
FileNotFoundException

也可以看看:

openTypedAssetFile

Added in API level 19
AssetFileDescriptor openTypedAssetFile (Uri uri, 
                String mimeTypeFilter, 
                Bundle opts)

实现由父类提供。 不能被重写。

Parameters
uri Uri: The data in the content provider being queried.
mimeTypeFilter String: The type of data the client desires. May be a pattern, such as */*, if the caller does not have specific type requirements; in this case the content provider will pick its best type matching the pattern.
opts Bundle: Additional options from the client. The definitions of these are specific to the content provider being called.
Returns
AssetFileDescriptor Returns a new AssetFileDescriptor from which the client can read data of the desired type.
Throws
FileNotFoundException

也可以看看:

openTypedAssetFile

Added in API level 19
AssetFileDescriptor openTypedAssetFile (Uri uri, 
                String mimeTypeFilter, 
                Bundle opts, 
                CancellationSignal signal)

实现由父类提供。 不能被重写。

Parameters
uri Uri: The data in the content provider being queried.
mimeTypeFilter String: The type of data the client desires. May be a pattern, such as */*, if the caller does not have specific type requirements; in this case the content provider will pick its best type matching the pattern.
opts Bundle: Additional options from the client. The definitions of these are specific to the content provider being called.
signal CancellationSignal: A signal to cancel the operation in progress, or null if none. For example, if you are downloading a file from the network to service a "rw" mode request, you should periodically call throwIfCanceled() to check whether the client has canceled the request and abort the download.
Returns
AssetFileDescriptor Returns a new AssetFileDescriptor from which the client can read data of the desired type.
Throws
FileNotFoundException

也可以看看:

openTypedDocument

Added in API level 24
AssetFileDescriptor openTypedDocument (String documentId, 
                String mimeTypeFilter, 
                Bundle opts, 
                CancellationSignal signal)

以与指定的MIME类型过滤器匹配的格式打开并返回文档。

如果文档的MIME类型与指定的MIME类型过滤器不匹配,则提供程序可能会执行转换。

Parameters
documentId String: the document to return.
mimeTypeFilter String: the MIME type filter for the requested format. May be *\/*, which matches any MIME type.
opts Bundle: extra options from the client. Specific to the content provider.
signal CancellationSignal: used by the caller to signal if the request should be cancelled. May be null.
Returns
AssetFileDescriptor
Throws
FileNotFoundException

也可以看看:

query

Added in API level 19
Cursor query (Uri uri, 
                String[] projection, 
                String selection, 
                String[] selectionArgs, 
                String sortOrder)

实现由父类提供。 不能被重写。

Parameters
uri Uri: The URI to query. This will be the full URI sent by the client; if the client is requesting a specific record, the URI will end in a record number that the implementation should parse and add to a WHERE or HAVING clause, specifying that _id value.
projection String: The list of columns to put into the cursor. If null all columns are included.
selection String: A selection criteria to apply when filtering rows. If null then all rows are included.
selectionArgs String: You may include ?s in selection, which will be replaced by the values from selectionArgs, in order that they appear in the selection. The values will be bound as Strings.
sortOrder String: How the rows in the cursor should be sorted. If null then the provider is free to define the sort order.
Returns
Cursor a Cursor or null.

也可以看看:

queryChildDocuments

Added in API level 19
Cursor queryChildDocuments (String parentDocumentId, 
                String[] projection, 
                String sortOrder)

返回请求的目录中包含的子文档。 这只能返回直接后代,因为会发出额外的查询来递归探索树。

如果您的提供程序是基于云的,并且您有一些数据在本地缓存或固定,则可以立即返回本地数据,并在光标上设置EXTRA_LOADING以表明您仍在提取其他数据。 然后,当网络数据可用时,您可以发送更改通知来触发重新查询并返回完整内容。 要返回一个带额外光标的光标,您需要扩展并覆盖getExtras()

要支持更改通知,必须将setNotificationUri(ContentResolver, Uri)与相关的Uri相关联,例如buildChildDocumentsUri(String, String) 然后您可以拨打notifyChange(Uri, android.database.ContentObserver, boolean)与该Uri发送更改通知。

Parameters
parentDocumentId String: the directory to return children for.
projection String: list of DocumentsContract.Document columns to put into the cursor. If null all supported columns should be included.
sortOrder String: how to order the rows, formatted as an SQL ORDER BY clause (excluding the ORDER BY itself). Passing null will use the default sort order, which may be unordered. This ordering is a hint that can be used to prioritize how data is fetched from the network, but UI may always enforce a specific ordering.
Returns
Cursor
Throws
FileNotFoundException

也可以看看:

queryDocument

Added in API level 19
Cursor queryDocument (String documentId, 
                String[] projection)

返回单个请求文档的元数据。 您应该避免发出网络请求来快速保留此请求。

Parameters
documentId String: the document to return.
projection String: list of DocumentsContract.Document columns to put into the cursor. If null all supported columns should be included.
Returns
Cursor
Throws
FileNotFoundException

queryRecentDocuments

Added in API level 19
Cursor queryRecentDocuments (String rootId, 
                String[] projection)

根据请求的根目录返回最近修改的文档。 这只会被称为为FLAG_SUPPORTS_RECENTS做广告的FLAG_SUPPORTS_RECENTS 返回的文档应按降序排列COLUMN_LAST_MODIFIED ,并且仅限于返回最近修改的64个文档。

最近的文档不支持更改通知。

Parameters
rootId String
projection String: list of DocumentsContract.Document columns to put into the cursor. If null all supported columns should be included.
Returns
Cursor
Throws
FileNotFoundException

也可以看看:

queryRoots

Added in API level 19
Cursor queryRoots (String[] projection)

返回当前提供的所有根。 要向用户显示,您必须至少定义一个根。 您应该避免发出网络请求来快速保留此请求。

每个根由 DocumentsContract.Root描述的元数据列定义,其中包括 COLUMN_DOCUMENT_ID ,它指向代表要在该根下显示的文档树的目录。

如果这组根改变了,你必须调用 notifyChange(Uri, android.database.ContentObserver, boolean)buildRootsUri(String)来通知系统。

Parameters
projection String: list of DocumentsContract.Root columns to put into the cursor. If null all supported columns should be included.
Returns
Cursor
Throws
FileNotFoundException

querySearchDocuments

Added in API level 19
Cursor querySearchDocuments (String rootId, 
                String query, 
                String[] projection)

在请求的根目录下返回与给定查询匹配的文档。 返回的文档应按照相关性降序排列。 文档如何与查询字符串匹配是每个提供者的实现细节,但建议至少COLUMN_DISPLAY_NAME以不区分大小写的方式进行匹配。

只有文件可以退回; 搜索结果中不支持目录。

如果您的提供程序是基于云的,并且您有一些数据在本地缓存或固定,则可以立即返回本地数据,在光标上设置EXTRA_LOADING以指示您仍在提取其他数据。 然后,当网络数据可用时,您可以发送更改通知来触发重新查询并返回完整内容。

要支持更改通知,必须将setNotificationUri(ContentResolver, Uri)与相关的Uri相关联,例如buildSearchDocumentsUri(String, String, String) 然后,您可以拨打notifyChange(Uri, android.database.ContentObserver, boolean)与该Uri发送更改通知。

Parameters
rootId String: the root to search under.
query String: string to match documents against.
projection String: list of DocumentsContract.Document columns to put into the cursor. If null all supported columns should be included.
Returns
Cursor
Throws
FileNotFoundException

也可以看看:

removeDocument

Added in API level 24
void removeDocument (String documentId, 
                String parentDocumentId)

删除请求的文档或文档树。

deleteDocument(String)相比,它需要指定父级。 如果文档可以在多个父母中,则此方法特别有用。

如果文档从最后一位父母中删除,并且实际上文档被删除,则提供者有责任撤销授予。

Parameters
documentId String: the document to remove.
parentDocumentId String: the parent of the document to move.
Throws
FileNotFoundException

renameDocument

Added in API level 21
String renameDocument (String documentId, 
                String displayName)

重命名现有文档。

如果必须使用不同的COLUMN_DOCUMENT_ID来表示重命名文档,请生成并返回它。 任何未完成的URI权限授予都将更新为指向新文档。 如果原始COLUMN_DOCUMENT_ID在重命名后仍然有效,则返回null

Parameters
documentId String: the document to rename.
displayName String: the updated display name of the document. The provider may alter this name to meet any internal constraints, such as avoiding conflicting names.
Returns
String
Throws
FileNotFoundException

revokeDocumentPermission

Added in API level 21
void revokeDocumentPermission (String documentId)

撤销给定的COLUMN_DOCUMENT_ID任何活动权限授予,通常在文档变为无效时调用。 遵循与revokeUriPermission(Uri, int)相同的语义。

Parameters
documentId String

update

Added in API level 19
int update (Uri uri, 
                ContentValues values, 
                String selection, 
                String[] selectionArgs)

实现由父类提供。 默认引发,不能被重写。

Parameters
uri Uri: The URI to query. This can potentially have a record ID if this is an update request for a specific record.
values ContentValues: A set of column_name/value pairs to update in the database. This must not be null.
selection String: An optional filter to match rows to update.
selectionArgs String
Returns
int the number of rows affected.

Hooray!