The second Android 11 Developer Preview is now available, test it out and share your feedback.

DisplayCompat.ModeCompat

public static final class DisplayCompat.ModeCompat
extends Object

java.lang.Object
   ↳ androidx.core.view.DisplayCompat.ModeCompat


Compat class which provides an additional isNative() field. This field indicates whether a mode is native, which is important when searching for the highest possible native resolution of a display.

Summary

Public methods

int getPhysicalHeight()

Returns the physical height of the given display when configured in this mode

int getPhysicalWidth()

Returns the physical width of the given display when configured in this mode

boolean isNative()

This field indicates whether a mode is native, which is important when searching for the highest possible native resolution of a display.

Display.Mode toMode()

Function to get the wrapped object

Inherited methods

Public methods

getPhysicalHeight

public int getPhysicalHeight ()

Returns the physical height of the given display when configured in this mode

Returns
int the physical screen height in pixels

getPhysicalWidth

public int getPhysicalWidth ()

Returns the physical width of the given display when configured in this mode

Returns
int the physical screen width in pixels

isNative

public boolean isNative ()

This field indicates whether a mode is native, which is important when searching for the highest possible native resolution of a display.

Returns
boolean true if this is a native mode of the wrapped display

toMode

public Display.Mode toMode ()

Function to get the wrapped object

Returns
Display.Mode the wrapped Display.Mode object or null if there was no matching mode for the native resolution.