Skip to content

Most visited

Recently visited

navigation

MediaStore.Images.Media

public static final class MediaStore.Images.Media
extends Object implements MediaStore.Images.ImageColumns

java.lang.Object
   ↳ android.provider.MediaStore.Images.Media


Summary

Constants

String CONTENT_TYPE

The MIME type of of this directory of images.

String DEFAULT_SORT_ORDER

The default sort order for this table

Inherited constants

From interface android.provider.MediaStore.Images.ImageColumns
From interface android.provider.MediaStore.MediaColumns
From interface android.provider.BaseColumns

Fields

public static final Uri EXTERNAL_CONTENT_URI

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

public static final Uri INTERNAL_CONTENT_URI

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

Public constructors

MediaStore.Images.Media()

Public methods

static final Bitmap getBitmap(ContentResolver cr, Uri url)

Retrieves an image for the given url as a Bitmap.

static Uri getContentUri(String volumeName)

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

static final String insertImage(ContentResolver cr, String imagePath, String name, String description)

Insert an image and create a thumbnail for it.

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

Insert an image and create a thumbnail for it.

static final Cursor query(ContentResolver cr, Uri uri, String[] projection)
static final Cursor query(ContentResolver cr, Uri uri, String[] projection, String where, String orderBy)
static final Cursor query(ContentResolver cr, Uri uri, String[] projection, String selection, String[] selectionArgs, String orderBy)

Inherited methods

From class java.lang.Object

Constants

CONTENT_TYPE

added in API level 1
String CONTENT_TYPE

The MIME type of 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.

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

DEFAULT_SORT_ORDER

added in API level 1
String DEFAULT_SORT_ORDER

The default sort order for this table

Constant Value: "bucket_display_name"

Fields

EXTERNAL_CONTENT_URI

added in API level 1
Uri EXTERNAL_CONTENT_URI

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

INTERNAL_CONTENT_URI

added in API level 1
Uri INTERNAL_CONTENT_URI

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

Public constructors

MediaStore.Images.Media

added in API level 1
MediaStore.Images.Media ()

Public methods

getBitmap

added in API level 1
Bitmap getBitmap (ContentResolver cr, 
                Uri url)

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

Returns
Bitmap

Throws
FileNotFoundException
IOException
FileNotFoundException

getContentUri

added in API level 1
Uri getContentUri (String volumeName)

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

Returns
Uri the URI to the image media table on the given volume

insertImage

added in API level 1
String insertImage (ContentResolver cr, 
                String imagePath, 
                String name, 
                String description)

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

Returns
String The URL to the newly created image

Throws
FileNotFoundException

insertImage

added in API level 1
String insertImage (ContentResolver cr, 
                Bitmap source, 
                String title, 
                String description)

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

Returns
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
Cursor query (ContentResolver cr, 
                Uri uri, 
                String[] projection)

Parameters
cr ContentResolver

uri Uri

projection String

Returns
Cursor

query

added in API level 1
Cursor query (ContentResolver cr, 
                Uri uri, 
                String[] projection, 
                String where, 
                String orderBy)

Parameters
cr ContentResolver

uri Uri

projection String

where String

orderBy String

Returns
Cursor

query

added in API level 1
Cursor query (ContentResolver cr, 
                Uri uri, 
                String[] projection, 
                String selection, 
                String[] selectionArgs, 
                String orderBy)

Parameters
cr ContentResolver

uri Uri

projection String

selection String

selectionArgs String

orderBy String

Returns
Cursor

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)