Partager via


MediaStore.Images.Media.InterfaceConsts.RelativePath Field

Definition

Relative path of this media item within the storage device where it is persisted.

[Android.Runtime.Register("RELATIVE_PATH", ApiSince=29)]
public const string RelativePath;
[<Android.Runtime.Register("RELATIVE_PATH", ApiSince=29)>]
val mutable RelativePath : string

Field Value

Attributes

Remarks

Relative path of this media item within the storage device where it is persisted. For example, an item stored at /storage/0000-0000/DCIM/Vacation/IMG1024.JPG would have a path of DCIM/Vacation/.

This value should only be used for organizational purposes, and you should not attempt to construct or access a raw filesystem path using this value. If you need to open a media item, use an API like ContentResolver#openFileDescriptor(Uri, String).

When this value is set to NULL during an ContentResolver#insert operation, the newly created item will be placed in a relevant default location based on the type of media being inserted. For example, a image/jpeg item will be placed under Environment#DIRECTORY_PICTURES.

You can modify this column during an ContentResolver#update call, which will move the underlying file on disk.

In both cases above, content must be placed under a top-level directory that is relevant to the media type. For example, attempting to place a audio/mpeg file under Environment#DIRECTORY_PICTURES will be rejected.

Java documentation for android.provider.MediaStore.MediaColumns.RELATIVE_PATH.

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