# DisplayManagerCompat

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1  
Summary:[Constants](https://developer.android.com/reference/android/support/v4/hardware/display/DisplayManagerCompat#constants)\|[Methods](https://developer.android.com/reference/android/support/v4/hardware/display/DisplayManagerCompat#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/v4/hardware/display/DisplayManagerCompat#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/v4/hardware/display/DisplayManagerCompat#)  

# DisplayManagerCompat

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public


abstract
class
DisplayManagerCompat
`  
`

extends Object


``


`

|---|----------------------------------------------------------|
| java.lang.Object                                            ||
| ↳ | android.support.v4.hardware.display.DisplayManagerCompat |

<br />

*** ** * ** ***

Helper for accessing features in[DisplayManager](https://developer.android.com/reference/android/hardware/display/DisplayManager.html).

## Summary

|                                                                                                   ### Constants                                                                                                    ||
|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `String` | [DISPLAY_CATEGORY_PRESENTATION](https://developer.android.com/reference/android/support/v4/hardware/display/DisplayManagerCompat#DISPLAY_CATEGORY_PRESENTATION) Display category: Presentation displays. |

|                                                                                                                                                                                                                  ### Public methods                                                                                                                                                                                                                  ||
|------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` abstract `[Display](https://developer.android.com/reference/android/view/Display.html)                                           | ` `[getDisplay](https://developer.android.com/reference/android/support/v4/hardware/display/DisplayManagerCompat#getDisplay(int))`(int displayId) ` Gets information about a logical display.                                                                                                                    |
| ` abstract `[Display[]](https://developer.android.com/reference/android/view/Display.html)                                         | ` `[getDisplays](https://developer.android.com/reference/android/support/v4/hardware/display/DisplayManagerCompat#getDisplays())`() ` Gets all currently valid logical displays.                                                                                                                                 |
| ` abstract `[Display[]](https://developer.android.com/reference/android/view/Display.html)                                         | ` `[getDisplays](https://developer.android.com/reference/android/support/v4/hardware/display/DisplayManagerCompat#getDisplays(java.lang.String))`(String category) ` Gets all currently valid logical displays of the specified category.                                                                        |
| ` static `[DisplayManagerCompat](https://developer.android.com/reference/android/support/v4/hardware/display/DisplayManagerCompat) | ` `[getInstance](https://developer.android.com/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. |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v4/hardware/display/DisplayManagerCompat#)From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` 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() `                    | ||

## Constants

### DISPLAY_CATEGORY_PRESENTATION

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
String DISPLAY_CATEGORY_PRESENTATION
```

Display category: Presentation displays.

This category can be used to identify secondary displays that are suitable for use as presentation displays.

<br />

<br />

**See also:**

- [for information about presenting content
  on secondary displays.](https://developer.android.com/https://developer.android.com/reference/android/app/Presentation)
- [getDisplays(String)](https://developer.android.com/reference/android/support/v4/hardware/display/DisplayManagerCompat#getDisplays(java.lang.String))

Constant Value: "android.hardware.display.category.PRESENTATION"

## Public methods

### getDisplay

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
Display getDisplay (int displayId)
```

Gets information about a logical display. The display metrics may be adjusted to provide compatibility for legacy applications.

<br />

|                     Parameters                     ||
|-------------|---------------------------------------|
| `displayId` | `int`: The logical display id. <br /> |

|                                                                             Returns                                                                              ||
|------------------------------------------------------------------------------|------------------------------------------------------------------------------------|
| [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. <br /> |

### getDisplays

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
Display[] getDisplays ()
```

Gets all currently valid logical displays.

<br />

|                                                         Returns                                                          ||
|--------------------------------------------------------------------------------|------------------------------------------|
| [Display[]](https://developer.android.com/reference/android/view/Display.html) | An array containing all displays. <br /> |

### getDisplays

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
Display[] getDisplays (String category)
```

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](https://developer.android.com/reference/android/support/v4/hardware/display/DisplayManagerCompat#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.

<br />

<br />

|                                         Parameters                                          ||
|------------|---------------------------------------------------------------------------------|
| `category` | `String`: The requested display category or null to return all displays. <br /> |

|                                                                        Returns                                                                         ||
|--------------------------------------------------------------------------------|------------------------------------------------------------------------|
| [Display[]](https://developer.android.com/reference/android/view/Display.html) | An array containing all displays sorted by order of preference. <br /> |

**See also:**

- [DISPLAY_CATEGORY_PRESENTATION](https://developer.android.com/reference/android/support/v4/hardware/display/DisplayManagerCompat#DISPLAY_CATEGORY_PRESENTATION)  

### getInstance

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
DisplayManagerCompat getInstance (Context context)
```

Gets an instance of the display manager given the context.

<br />

|         Parameters          ||
|-----------|------------------|
| `context` | `Context` <br /> |

|                                                             Returns                                                              ||
|--------------------------------------------------------------------------------------------------------------------------|--------|
| [DisplayManagerCompat](https://developer.android.com/reference/android/support/v4/hardware/display/DisplayManagerCompat) | <br /> |

-

  ## Classes

  - [DisplayManagerCompat](https://developer.android.com/reference/android/support/v4/hardware/display/DisplayManagerCompat)