Stay organized with collections
Save and categorize content based on your preferences.
DisplayPhoto
class DisplayPhoto
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
Properties |
static Uri! |
This URI allows the caller to query for the maximum dimensions of a display photo or thumbnail.
|
static Uri! |
The content:// style URI for this class, which allows access to full-size photos, given a key.
|
Constants
DISPLAY_MAX_DIM
static val DISPLAY_MAX_DIM: String
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.
Value: "display_max_dim"
Properties
CONTENT_MAX_DIMENSIONS_URI
static val CONTENT_MAX_DIMENSIONS_URI: 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
static val CONTENT_URI: 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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# ContactsContract.DisplayPhoto\n\nAdded in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nDisplayPhoto\n============\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/provider/ContactsContract.DisplayPhoto \"View this page in Java\") \n\n```\nclass DisplayPhoto\n```\n\n|---|-----------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.provider.ContactsContract.DisplayPhoto](#) |\n\nHelper class for accessing full-size photos by photo file ID.\n\nUsage example:\n\nRetrieving a full-size photo by photo file ID (see [ContactsContract.ContactsColumns.PHOTO_FILE_ID](/reference/kotlin/android/provider/ContactsContract.ContactsColumns#PHOTO_FILE_ID:kotlin.String))\n:\n\n ```kotlin\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\nSummary\n-------\n\n| Constants ||\n|-----------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [DISPLAY_MAX_DIM](#DISPLAY_MAX_DIM:kotlin.String) Queries to [ContactsContract.DisplayPhoto.CONTENT_MAX_DIMENSIONS_URI](#CONTENT_MAX_DIMENSIONS_URI:android.net.Uri) will contain this column, populated with the maximum height and width (in pixels) that will be stored for a display photo. |\n| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [THUMBNAIL_MAX_DIM](#THUMBNAIL_MAX_DIM:kotlin.String) Queries to [ContactsContract.DisplayPhoto.CONTENT_MAX_DIMENSIONS_URI](#CONTENT_MAX_DIMENSIONS_URI:android.net.Uri) will contain this column, populated with the height and width (in pixels) for photo thumbnails. |\n\n| Properties ||\n|---------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| static [Uri](../net/Uri.html#)! | [CONTENT_MAX_DIMENSIONS_URI](#CONTENT_MAX_DIMENSIONS_URI:android.net.Uri) This URI allows the caller to query for the maximum dimensions of a display photo or thumbnail. |\n| static [Uri](../net/Uri.html#)! | [CONTENT_URI](#CONTENT_URI:android.net.Uri) The content:// style URI for this class, which allows access to full-size photos, given a key. |\n\nConstants\n---------\n\n### DISPLAY_MAX_DIM\n\nAdded in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val DISPLAY_MAX_DIM: String\n```\n\nQueries to [ContactsContract.DisplayPhoto.CONTENT_MAX_DIMENSIONS_URI](#CONTENT_MAX_DIMENSIONS_URI:android.net.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. \n\n Value: \"display_max_dim\"\n\n### THUMBNAIL_MAX_DIM\n\nAdded in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val THUMBNAIL_MAX_DIM: String\n```\n\nQueries to [ContactsContract.DisplayPhoto.CONTENT_MAX_DIMENSIONS_URI](#CONTENT_MAX_DIMENSIONS_URI:android.net.Uri) will contain this column, populated with the height and width (in pixels) for photo thumbnails. \n\n Value: \"thumbnail_max_dim\"\n\nProperties\n----------\n\n### CONTENT_MAX_DIMENSIONS_URI\n\nAdded in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val CONTENT_MAX_DIMENSIONS_URI: Uri!\n```\n\nThis 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. \n\n### CONTENT_URI\n\nAdded in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val CONTENT_URI: Uri!\n```\n\nThe content:// style URI for this class, which allows access to full-size photos, given a key."]]