Added in API level 1

Media


class Media : MediaStore.Images.ImageColumns
kotlin.Any
   ↳ android.provider.MediaStore.Images.Media

Summary

Constants
static String

The MIME type of this directory of images.

static String

The default sort order for this table

Inherited constants
Public constructors

Public methods
static Bitmap!

Retrieves an image for the given url as a Bitmap.

static Uri!
getContentUri(volumeName: String!)

Get the content:// style URI for the image media table on the given volume.

static Uri
getContentUri(volumeName: String, id: Long)

Get the content:// style URI for a single row in the images table on the given volume.

static String!
insertImage(cr: ContentResolver!, imagePath: String!, name: String!, description: String!)

Insert an image and create a thumbnail for it.

static String!
insertImage(cr: ContentResolver!, source: Bitmap!, title: String!, description: String!)

Insert an image and create a thumbnail for it.

static Cursor!
query(cr: ContentResolver!, uri: Uri!, projection: Array<String!>!)

static Cursor!
query(cr: ContentResolver!, uri: Uri!, projection: Array<String!>!, where: String!, orderBy: String!)

static Cursor!
query(cr: ContentResolver!, uri: Uri!, projection: Array<String!>!, selection: String!, selectionArgs: Array<String!>!, orderBy: String!)

Properties
static Uri!

The content:// style URI for the "primary" external storage volume.

static Uri!

The content:// style URI for the internal storage.

Constants

CONTENT_TYPE

Added in API level 1
static val CONTENT_TYPE: String

The MIME type of this directory of images. Note that each entry in this directory will have a standard image MIME type as appropriate -- for example, image/jpeg.

Value: "vnd.android.cursor.dir/image"

DEFAULT_SORT_ORDER

Added in API level 1
static val DEFAULT_SORT_ORDER: String

The default sort order for this table

Value: "bucket_display_name"

Public constructors

Media

Added in API level 1
Media()

Public methods

getBitmap

Added in API level 1
Deprecated in API level 29
static fun getBitmap(
    cr: ContentResolver!,
    url: Uri!
): Bitmap!

Deprecated: loading of images should be performed through ImageDecoder#createSource(ContentResolver, Uri), which offers modern features like PostProcessor.

Retrieves an image for the given url as a Bitmap.

Parameters
cr ContentResolver!: The content resolver to use
url Uri!: The url of the image

getContentUri

Added in API level 1
static fun getContentUri(volumeName: String!): Uri!

Get the content:// style URI for the image media table on the given volume.

Parameters
volumeName String!: the name of the volume to get the URI for
Return
Uri! the URI to the image media table on the given volume

getContentUri

Added in API level 30
static fun getContentUri(
    volumeName: String,
    id: Long
): Uri

Get the content:// style URI for a single row in the images table on the given volume.

Parameters
volumeName String: the name of the volume to get the URI for This value cannot be null.
id Long: the image to get the URI for
Return
Uri the URI to the images table on the given volume This value cannot be null.

insertImage

Added in API level 1
Deprecated in API level 29
static fun insertImage(
    cr: ContentResolver!,
    imagePath: String!,
    name: String!,
    description: String!
): String!

Deprecated: inserting of images should be performed using MediaColumns#IS_PENDING, which offers richer control over lifecycle.

Insert an image and create a thumbnail for it.

Parameters
cr ContentResolver!: The content resolver to use
imagePath String!: The path to the image to insert
name String!: The name of the image
description String!: The description of the image
Return
String! The URL to the newly created image

insertImage

Added in API level 1
Deprecated in API level 29
static fun insertImage(
    cr: ContentResolver!,
    source: Bitmap!,
    title: String!,
    description: String!
): String!

Deprecated: inserting of images should be performed using MediaColumns#IS_PENDING, which offers richer control over lifecycle.

Insert an image and create a thumbnail for it.

Parameters
cr ContentResolver!: The content resolver to use
source Bitmap!: The stream to use for the image
title String!: The name of the image
description String!: The description of the image
Return
String! The URL to the newly created image, or null if the image failed to be stored for any reason.

query

Added in API level 1
Deprecated in API level 29
static fun query(
    cr: ContentResolver!,
    uri: Uri!,
    projection: Array<String!>!
): Cursor!

Deprecated: all queries should be performed through ContentResolver directly, which offers modern features like CancellationSignal.

query

Added in API level 1
Deprecated in API level 29
static fun query(
    cr: ContentResolver!,
    uri: Uri!,
    projection: Array<String!>!,
    where: String!,
    orderBy: String!
): Cursor!

Deprecated: all queries should be performed through ContentResolver directly, which offers modern features like CancellationSignal.

query

Added in API level 1
Deprecated in API level 29
static fun query(
    cr: ContentResolver!,
    uri: Uri!,
    projection: Array<String!>!,
    selection: String!,
    selectionArgs: Array<String!>!,
    orderBy: String!
): Cursor!

Deprecated: all queries should be performed through ContentResolver directly, which offers modern features like CancellationSignal.

Properties

EXTERNAL_CONTENT_URI

Added in API level 1
static val EXTERNAL_CONTENT_URI: Uri!

The content:// style URI for the "primary" external storage volume.

INTERNAL_CONTENT_URI

Added in API level 1
static val INTERNAL_CONTENT_URI: Uri!

The content:// style URI for the internal storage.