# DisplayCompat.ModeCompat

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core)  
[View Source](https://cs.android.com/search?q=file:androidx/core/view/DisplayCompat.java+class:androidx.core.view.DisplayCompat.ModeCompat)  
Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/core#1.3.0)

*** ** * ** ***

Kotlin \|[Java](https://developer.android.com/reference/androidx/core/view/DisplayCompat.ModeCompat "View this page in Java")


```
class DisplayCompat.ModeCompat
```

<br />

*** ** * ** ***

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

## Summary

| ### Public functions |
|---|---|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [getPhysicalHeight](https://developer.android.com/reference/kotlin/androidx/core/view/DisplayCompat.ModeCompat#getPhysicalHeight())`()` Returns the physical height of the given display when configured in this mode. |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [getPhysicalWidth](https://developer.android.com/reference/kotlin/androidx/core/view/DisplayCompat.ModeCompat#getPhysicalWidth())`()` Returns the physical width of the given display when configured in this mode. |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | ~~[isNative](https://developer.android.com/reference/kotlin/androidx/core/view/DisplayCompat.ModeCompat#isNative())~~`()` **This function is deprecated.** Use [getMode](https://developer.android.com/reference/kotlin/androidx/core/view/DisplayCompat#getMode(android.content.Context,android.view.Display)) to retrieve the resolution of the current display mode. <br /> |
| [Display.Mode](https://developer.android.com/reference/android/view/Display.Mode.html)`?` | [toMode](https://developer.android.com/reference/kotlin/androidx/core/view/DisplayCompat.ModeCompat#toMode())`()` Returns the wrapped object Display.Mode, which may be null if no mode is available. |

## Public functions

### getPhysicalHeight

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/core#1.3.0)  

```
fun getPhysicalHeight(): Int
```

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

### getPhysicalWidth

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/core#1.3.0)  

```
fun getPhysicalWidth(): Int
```

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

### isNative

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/core#1.3.0)  
Deprecated in [1.6.0](https://developer.android.com/jetpack/androidx/releases/core#1.6.0)  

```
fun [isNative](https://developer.android.com/reference/kotlin/androidx/core/view/DisplayCompat.ModeCompat#isNative())(): Boolean
```
| **This function is deprecated.**   
|
| Use [getMode](https://developer.android.com/reference/kotlin/androidx/core/view/DisplayCompat#getMode(android.content.Context,android.view.Display)) to retrieve the resolution of the current display mode.

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.  

| Returns |
|---|---|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | true if this mode is the same resolution as the current display mode. |

### toMode

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/core#1.3.0)  

```
fun toMode(): Display.Mode?
```

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