Stay organized with collections
Save and categorize content based on your preferences.
public
static
final
class
ContactsContract.DisplayPhoto
extends Object
Helper class for accessing full-size photos by photo file ID.
Usage example:
- Retrieving a full-size photo by photo file ID (see
ContactsContract.ContactsColumns.PHOTO_FILE_ID
)
-
public InputStream openDisplayPhoto(long photoFileId) {
Uri displayPhotoUri = ContentUris.withAppendedId(DisplayPhoto.CONTENT_URI, photoKey);
try {
AssetFileDescriptor fd = getContentResolver().openAssetFileDescriptor(
displayPhotoUri, "r");
return fd.createInputStream();
} catch (IOException e) {
return null;
}
}
Summary
Fields |
public
static
final
Uri |
CONTENT_MAX_DIMENSIONS_URI
This URI allows the caller to query for the maximum dimensions of a display photo
or thumbnail.
|
public
static
final
Uri |
CONTENT_URI
The content:// style URI for this class, which allows access to full-size photos,
given a key.
|
Inherited methods |
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object .
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait(long timeoutMillis, int nanos)
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted, or until a
certain amount of real time has elapsed.
|
final
void
|
wait(long timeoutMillis)
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted, or until a
certain amount of real time has elapsed.
|
final
void
|
wait()
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted.
|
|
Constants
DISPLAY_MAX_DIM
public static final String DISPLAY_MAX_DIM
Queries to ContactsContract.DisplayPhoto.CONTENT_MAX_DIMENSIONS_URI
will
contain this column, populated with the maximum height and width (in pixels)
that will be stored for a display photo. Larger photos will be down-sized to
fit within a square of this many pixels.
Constant Value:
"display_max_dim"
Fields
CONTENT_MAX_DIMENSIONS_URI
public static final Uri CONTENT_MAX_DIMENSIONS_URI
This URI allows the caller to query for the maximum dimensions of a display photo
or thumbnail. Requests to this URI can be performed on the UI thread because
they are always unblocking.
CONTENT_URI
public static final Uri CONTENT_URI
The content:// style URI for this class, which allows access to full-size photos,
given a key.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# ContactsContract.DisplayPhoto\n\nAdded in [API level 14](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Constants](#constants) \\| [Fields](#lfields) \\| [Inherited Methods](#inhmethods) \n\nContactsContract.DisplayPhoto\n=============================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/provider/ContactsContract.DisplayPhoto \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\nstatic\nfinal\n\nclass\nContactsContract.DisplayPhoto\n`\n\n\n`\n\nextends `[Object](/reference/java/lang/Object)`\n\n\n`\n\n`\n\n\n`\n\n|---|------------------------------------------------|\n| [java.lang.Object](/reference/java/lang/Object) ||\n| ↳ | android.provider.ContactsContract.DisplayPhoto |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nHelper class for accessing full-size photos by photo file ID.\n\n\nUsage example:\n\nRetrieving a full-size photo by photo file ID (see\n[ContactsContract.ContactsColumns.PHOTO_FILE_ID](/reference/android/provider/ContactsContract.ContactsColumns#PHOTO_FILE_ID))\n:\n\n ```\n public InputStream openDisplayPhoto(long photoFileId) {\n Uri displayPhotoUri = ContentUris.withAppendedId(DisplayPhoto.CONTENT_URI, photoKey);\n try {\n AssetFileDescriptor fd = getContentResolver().openAssetFileDescriptor(\n displayPhotoUri, \"r\");\n return fd.createInputStream();\n } catch (IOException e) {\n return null;\n }\n }\n \n ```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nSummary\n-------\n\n| ### Constants ||\n|---------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [String](/reference/java/lang/String) | [DISPLAY_MAX_DIM](/reference/android/provider/ContactsContract.DisplayPhoto#DISPLAY_MAX_DIM) Queries to [ContactsContract.DisplayPhoto.CONTENT_MAX_DIMENSIONS_URI](/reference/android/provider/ContactsContract.DisplayPhoto#CONTENT_MAX_DIMENSIONS_URI) will contain this column, populated with the maximum height and width (in pixels) that will be stored for a display photo. |\n| [String](/reference/java/lang/String) | [THUMBNAIL_MAX_DIM](/reference/android/provider/ContactsContract.DisplayPhoto#THUMBNAIL_MAX_DIM) Queries to [ContactsContract.DisplayPhoto.CONTENT_MAX_DIMENSIONS_URI](/reference/android/provider/ContactsContract.DisplayPhoto#CONTENT_MAX_DIMENSIONS_URI) will contain this column, populated with the height and width (in pixels) for photo thumbnails. |\n\n| ### Fields ||\n|----------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` public static final `[Uri](/reference/android/net/Uri) | [CONTENT_MAX_DIMENSIONS_URI](/reference/android/provider/ContactsContract.DisplayPhoto#CONTENT_MAX_DIMENSIONS_URI) This URI allows the caller to query for the maximum dimensions of a display photo or thumbnail. |\n| ` public static final `[Uri](/reference/android/net/Uri) | [CONTENT_URI](/reference/android/provider/ContactsContract.DisplayPhoto#CONTENT_URI) The content:// style URI for this class, which allows access to full-size photos, given a key. |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From class ` `[java.lang.Object](/reference/java/lang/Object)` ` |---------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](/reference/java/lang/Object) | ` `[clone](/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object. | | ` boolean` | ` `[equals](/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](/reference/java/lang/Object)` obj) ` Indicates whether some other object is \"equal to\" this one. | | ` void` | ` `[finalize](/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final `[Class](/reference/java/lang/Class)`\u003c?\u003e` | ` `[getClass](/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this `Object`. | | ` int` | ` `[hashCode](/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object. | | ` final void` | ` `[notify](/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` `[notifyAll](/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor. | | ` `[String](/reference/java/lang/String) | ` `[toString](/reference/java/lang/Object#toString())`() ` Returns a string representation of the object. | | ` final void` | ` `[wait](/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` `[wait](/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` `[wait](/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||\n\nConstants\n---------\n\n### DISPLAY_MAX_DIM\n\nAdded in [API level 14](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic static final String DISPLAY_MAX_DIM\n```\n\nQueries to [ContactsContract.DisplayPhoto.CONTENT_MAX_DIMENSIONS_URI](/reference/android/provider/ContactsContract.DisplayPhoto#CONTENT_MAX_DIMENSIONS_URI) will\ncontain this column, populated with the maximum height and width (in pixels)\nthat will be stored for a display photo. Larger photos will be down-sized to\nfit within a square of this many pixels.\n\n\u003cbr /\u003e\n\nConstant Value:\n\n\"display_max_dim\"\n\n\n### THUMBNAIL_MAX_DIM\n\nAdded in [API level 14](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic static final String THUMBNAIL_MAX_DIM\n```\n\nQueries to [ContactsContract.DisplayPhoto.CONTENT_MAX_DIMENSIONS_URI](/reference/android/provider/ContactsContract.DisplayPhoto#CONTENT_MAX_DIMENSIONS_URI) will\ncontain this column, populated with the height and width (in pixels) for photo\nthumbnails.\n\n\u003cbr /\u003e\n\nConstant Value:\n\n\"thumbnail_max_dim\"\n\n\nFields\n------\n\n### CONTENT_MAX_DIMENSIONS_URI\n\nAdded in [API level 14](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic static final Uri CONTENT_MAX_DIMENSIONS_URI\n```\n\nThis URI allows the caller to query for the maximum dimensions of a display photo\nor thumbnail. Requests to this URI can be performed on the UI thread because\nthey are always unblocking.\n\n\u003cbr /\u003e\n\n### CONTENT_URI\n\nAdded in [API level 14](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic static final Uri CONTENT_URI\n```\n\nThe content:// style URI for this class, which allows access to full-size photos,\ngiven a key.\n\n\u003cbr /\u003e"]]