Android 12 Developer Preview is here! Try it out, and give us your feedback!

ModeCompat

class ModeCompat
kotlin.Any
   ↳ androidx.core.view.DisplayCompat.ModeCompat

Compat class which provides access to the underlying display mode, if there is one, and a more reliable display mode size.

Summary

Public methods
Int

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

Int

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

Boolean

This field indicates whether a mode has the same resolution as the current display mode.

Mode?

Returns the wrapped object Display.

Public methods

getPhysicalHeight

fun getPhysicalHeight(): Int

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

getPhysicalWidth

fun getPhysicalWidth(): Int

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

isNative

fun isNative(): Boolean

This field indicates whether a mode has the same resolution as the current display mode.

This field does *not* indicate the native resolution of the display.

Return
Boolean true if this mode is the same resolution as the current display mode.

toMode

@RequiresApi(23) @Nullable fun toMode(): Mode?

Returns the wrapped object Display.Mode, which may be null if no mode is available.