DisplayManagerCompat

Added in 1.1.0

class DisplayManagerCompat


Helper for accessing features in android.hardware.display.DisplayManager.

Summary

Constants

const String!
DISPLAY_CATEGORY_PRESENTATION = "android.hardware.display.category.PRESENTATION"

Display category: Presentation displays.

Public functions

Display?
getDisplay(displayId: Int)

Gets information about a logical display.

Array<Display!>

Gets all currently valid logical displays.

Array<Display!>
getDisplays(category: String?)

Gets all currently valid logical displays of the specified category.

java-static DisplayManagerCompat
getInstance(context: Context)

Gets an instance of the display manager given the context.

Constants

DISPLAY_CATEGORY_PRESENTATION

Added in 1.1.0
const val DISPLAY_CATEGORY_PRESENTATION = "android.hardware.display.category.PRESENTATION": String!

Display category: Presentation displays.

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

See also
Presentation

for information about presenting content on secondary displays.

getDisplays

Public functions

getDisplay

Added in 1.1.0
fun getDisplay(displayId: Int): Display?

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

Parameters
displayId: Int

The logical display id.

Returns
Display?

The display object, or null if there is no valid display with the given id.

getDisplays

Added in 1.1.0
fun getDisplays(): Array<Display!>

Gets all currently valid logical displays.

Returns
Array<Display!>

An array containing all displays.

getDisplays

Added in 1.1.0
fun getDisplays(category: String?): Array<Display!>

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.

Returns
Array<Display!>

An array containing all displays sorted by order of preference.

getInstance

Added in 1.1.0
java-static fun getInstance(context: Context): DisplayManagerCompat

Gets an instance of the display manager given the context.