Gets all currently valid logical displays of the specified category.
When there are multiple displays in a category the returned displays are sorted
of preference. For example, if the requested category is
DISPLAY_CATEGORY_PRESENTATION and there are multiple presentation displays
then the displays are sorted so that the first display in the returned array
is the most preferred presentation display. The application may simply
use the first display or allow the user to choose.
Parameters
category
String: The requested display category or null to return all displays.
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,["# DisplayManagerCompat\n\nadded in [version 22.1.0](/topic/libraries/support-library/revisions) \nbelongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1 \nSummary: [Constants](#constants) \\| [Methods](#pubmethods) \\| [Inherited Methods](#inhmethods) \\| [\\[Expand All\\]](#) \n\nDisplayManagerCompat\n====================\n\n| This package is part of the Android [support library](/topic/libraries/support-library) which is no longer maintained. The support library has been superseded by [AndroidX](/jetpack/androidx) which is part of [Jetpack](/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider [migrating](/jetpack/androidx/migrate) existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library [class\n| mappings](/jetpack/androidx/migrate/class-mappings).\n\n\n`\npublic\n\n\nabstract\nclass\nDisplayManagerCompat\n`\n\n\n`\n\nextends Object\n\n\n`\n\n`\n\n\n`\n\n|---|----------------------------------------------------------|\n| java.lang.Object ||\n| ↳ | android.support.v4.hardware.display.DisplayManagerCompat |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nHelper for accessing features in [DisplayManager](https://developer.android.com/reference/android/hardware/display/DisplayManager.html).\n\nSummary\n-------\n\n| ### Constants ||\n|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `String` | [DISPLAY_CATEGORY_PRESENTATION](/reference/android/support/v4/hardware/display/DisplayManagerCompat#DISPLAY_CATEGORY_PRESENTATION) Display category: Presentation displays. |\n\n| ### Public methods ||\n|-------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract `[Display](https://developer.android.com/reference/android/view/Display.html) | ` `[getDisplay](/reference/android/support/v4/hardware/display/DisplayManagerCompat#getDisplay(int))`(int displayId) ` Gets information about a logical display. |\n| ` abstract `[Display[]](https://developer.android.com/reference/android/view/Display.html) | ` `[getDisplays](/reference/android/support/v4/hardware/display/DisplayManagerCompat#getDisplays())`() ` Gets all currently valid logical displays. |\n| ` abstract `[Display[]](https://developer.android.com/reference/android/view/Display.html) | ` `[getDisplays](/reference/android/support/v4/hardware/display/DisplayManagerCompat#getDisplays(java.lang.String))`(String category) ` Gets all currently valid logical displays of the specified category. |\n| ` static `[DisplayManagerCompat](/reference/android/support/v4/hardware/display/DisplayManagerCompat) | ` `[getInstance](/reference/android/support/v4/hardware/display/DisplayManagerCompat#getInstance(android.content.Context))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` context) ` Gets an instance of the display manager given the context. |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From class ` java.lang.Object ` |-------------------|-------------------------------| | ` Object` | ` clone() ` | | ` boolean` | ` equals(Object arg0) ` | | ` void` | ` finalize() ` | | ` final Class\u003c?\u003e` | ` getClass() ` | | ` int` | ` hashCode() ` | | ` final void` | ` notify() ` | | ` final void` | ` notifyAll() ` | | ` String` | ` toString() ` | | ` final void` | ` wait(long arg0, int arg1) ` | | ` final void` | ` wait(long arg0) ` | | ` final void` | ` wait() ` | ||\n\nConstants\n---------\n\n### DISPLAY_CATEGORY_PRESENTATION\n\nadded in [version 22.1.0](/topic/libraries/support-library/revisions) \n\n```\nString DISPLAY_CATEGORY_PRESENTATION\n```\n\nDisplay category: Presentation displays.\n\n\nThis category can be used to identify secondary displays that are suitable for\nuse as presentation displays.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n**See also:**\n\n- [for information about presenting content\n on secondary displays.](/https://developer.android.com/reference/android/app/Presentation)\n- [getDisplays(String)](/reference/android/support/v4/hardware/display/DisplayManagerCompat#getDisplays(java.lang.String))\n\nConstant Value:\n\n\"android.hardware.display.category.PRESENTATION\"\n\n\nPublic methods\n--------------\n\n### getDisplay\n\nadded in [version 22.1.0](/topic/libraries/support-library/revisions) \n\n```\nDisplay getDisplay (int displayId)\n```\n\nGets information about a logical display.\n\nThe display metrics may be adjusted to provide compatibility\nfor legacy applications.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-------------|---------------------------------------|\n| `displayId` | `int`: The logical display id. \u003cbr /\u003e |\n\n| Returns ||\n|------------------------------------------------------------------------------|------------------------------------------------------------------------------------|\n| [Display](https://developer.android.com/reference/android/view/Display.html) | The display object, or null if there is no valid display with the given id. \u003cbr /\u003e |\n\n### getDisplays\n\nadded in [version 22.1.0](/topic/libraries/support-library/revisions) \n\n```\nDisplay[] getDisplays ()\n```\n\nGets all currently valid logical displays.\n\n\u003cbr /\u003e\n\n| Returns ||\n|--------------------------------------------------------------------------------|------------------------------------------|\n| [Display[]](https://developer.android.com/reference/android/view/Display.html) | An array containing all displays. \u003cbr /\u003e |\n\n### getDisplays\n\nadded in [version 22.1.0](/topic/libraries/support-library/revisions) \n\n```\nDisplay[] getDisplays (String category)\n```\n\nGets all currently valid logical displays of the specified category.\n\n\nWhen there are multiple displays in a category the returned displays are sorted\nof preference. For example, if the requested category is\n[DISPLAY_CATEGORY_PRESENTATION](/reference/android/support/v4/hardware/display/DisplayManagerCompat#DISPLAY_CATEGORY_PRESENTATION) and there are multiple presentation displays\nthen the displays are sorted so that the first display in the returned array\nis the most preferred presentation display. The application may simply\nuse the first display or allow the user to choose.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------|---------------------------------------------------------------------------------|\n| `category` | `String`: The requested display category or null to return all displays. \u003cbr /\u003e |\n\n| Returns ||\n|--------------------------------------------------------------------------------|------------------------------------------------------------------------|\n| [Display[]](https://developer.android.com/reference/android/view/Display.html) | An array containing all displays sorted by order of preference. \u003cbr /\u003e |\n\n**See also:**\n\n- [DISPLAY_CATEGORY_PRESENTATION](/reference/android/support/v4/hardware/display/DisplayManagerCompat#DISPLAY_CATEGORY_PRESENTATION) \n\n### getInstance\n\nadded in [version 22.1.0](/topic/libraries/support-library/revisions) \n\n```\nDisplayManagerCompat getInstance (Context context)\n```\n\nGets an instance of the display manager given the context.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-----------|------------------|\n| `context` | `Context` \u003cbr /\u003e |\n\n| Returns ||\n|---------------------------------------------------------------------------------------------|--------|\n| [DisplayManagerCompat](/reference/android/support/v4/hardware/display/DisplayManagerCompat) | \u003cbr /\u003e |\n\n-\n\n Classes\n -------\n\n - [DisplayManagerCompat](/reference/android/support/v4/hardware/display/DisplayManagerCompat)"]]