Share via


DocumentsContract.GetDocumentMetadata(ContentResolver, Uri) Method

Definition

Returns metadata associated with the document.

[Android.Runtime.Register("getDocumentMetadata", "(Landroid/content/ContentResolver;Landroid/net/Uri;)Landroid/os/Bundle;", "", ApiSince=29)]
public static Android.OS.Bundle? GetDocumentMetadata (Android.Content.ContentResolver content, Android.Net.Uri documentUri);
[<Android.Runtime.Register("getDocumentMetadata", "(Landroid/content/ContentResolver;Landroid/net/Uri;)Landroid/os/Bundle;", "", ApiSince=29)>]
static member GetDocumentMetadata : Android.Content.ContentResolver * Android.Net.Uri -> Android.OS.Bundle

Parameters

content
ContentResolver
documentUri
Uri

a Document URI

Returns

a Bundle of Bundles.

Attributes

Remarks

Returns metadata associated with the document. The type of metadata returned is specific to the document type. For example the data returned for an image file will likely consist primarily or solely of EXIF metadata.

The returned Bundle will contain zero or more entries depending on the type of data supported by the document provider.

<ol> <li>A DocumentsContract#METADATA_TYPES containing a String[] value. The string array identifies the type or types of metadata returned. Each value in the can be used to access a Bundle of data containing that type of data. <li>An entry each for each type of returned metadata. Each set of metadata is itself represented as a bundle and accessible via a string key naming the type of data. </ol>

Example:

<code>
                Bundle metadata = DocumentsContract.getDocumentMetadata(client, imageDocUri, tags);
                if (metadata.containsKey(DocumentsContract.METADATA_EXIF)) {
                    Bundle exif = metadata.getBundle(DocumentsContract.METADATA_EXIF);
                    int imageLength = exif.getInt(ExifInterface.TAG_IMAGE_LENGTH);
                }
</code>

Java documentation for android.provider.DocumentsContract.getDocumentMetadata(android.content.ContentResolver, android.net.Uri).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to