Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Constants](https://developer.android.com/reference/android/util/DisplayMetrics#constants) \| [Fields](https://developer.android.com/reference/android/util/DisplayMetrics#lfields) \| [Ctors](https://developer.android.com/reference/android/util/DisplayMetrics#pubctors) \| [Methods](https://developer.android.com/reference/android/util/DisplayMetrics#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/util/DisplayMetrics#inhmethods)

# DisplayMetrics

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/util/DisplayMetrics "View this page in Kotlin") \|Java


`
public


class
DisplayMetrics
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.util.DisplayMetrics |

<br />

*** ** * ** ***

A structure describing general information about a display, such as its
size, density, and font scaling.

To access the DisplayMetrics members, retrieve display metrics like this:

```
context.getResources().getDisplayMetrics();
```


For UI layout, obtain `https://developer.android.com/reference/android/view/WindowMetrics` from
`https://developer.android.com/reference/android/view/WindowManager#getCurrentWindowMetrics()`. `DisplayMetrics` should only be used for
obtaining display related properties, such as `https://developer.android.com/reference/android/util/DisplayMetrics#xdpi` and `https://developer.android.com/reference/android/util/DisplayMetrics#ydpi`


See `https://developer.android.com/reference/android/util/DisplayMetrics#density` for more information about the differences between `https://developer.android.com/reference/android/util/DisplayMetrics#xdpi`,
`https://developer.android.com/reference/android/util/DisplayMetrics#ydpi` and `https://developer.android.com/reference/android/util/DisplayMetrics#density`.

<br />

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_140` Intermediate density for screens that sit between `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_LOW` (120dpi) and `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_MEDIUM` (160dpi). |
| `int` | `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_180` Intermediate density for screens that sit between `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_MEDIUM` (160dpi) and `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_HIGH` (240dpi). |
| `int` | `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_200` Intermediate density for screens that sit between `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_MEDIUM` (160dpi) and `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_HIGH` (240dpi). |
| `int` | `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_220` Intermediate density for screens that sit between `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_MEDIUM` (160dpi) and `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_HIGH` (240dpi). |
| `int` | `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_260` Intermediate density for screens that sit between `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_HIGH` (240dpi) and `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XHIGH` (320dpi). |
| `int` | `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_280` Intermediate density for screens that sit between `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_HIGH` (240dpi) and `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XHIGH` (320dpi). |
| `int` | `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_300` Intermediate density for screens that sit between `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_HIGH` (240dpi) and `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XHIGH` (320dpi). |
| `int` | `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_340` Intermediate density for screens that sit somewhere between `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XHIGH` (320 dpi) and `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXHIGH` (480 dpi). |
| `int` | `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_360` Intermediate density for screens that sit somewhere between `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XHIGH` (320 dpi) and `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXHIGH` (480 dpi). |
| `int` | `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_390` Intermediate density for screens that sit somewhere between `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XHIGH` (320 dpi) and `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXHIGH` (480 dpi). |
| `int` | `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_400` Intermediate density for screens that sit somewhere between `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XHIGH` (320 dpi) and `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXHIGH` (480 dpi). |
| `int` | `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_420` Intermediate density for screens that sit somewhere between `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XHIGH` (320 dpi) and `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXHIGH` (480 dpi). |
| `int` | `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_440` Intermediate density for screens that sit somewhere between `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XHIGH` (320 dpi) and `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXHIGH` (480 dpi). |
| `int` | `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_450` Intermediate density for screens that sit somewhere between `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XHIGH` (320 dpi) and `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXHIGH` (480 dpi). |
| `int` | `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_520` Intermediate density for screens that sit somewhere between `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXHIGH` (480 dpi) and `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXXHIGH` (640 dpi). |
| `int` | `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_560` Intermediate density for screens that sit somewhere between `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXHIGH` (480 dpi) and `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXXHIGH` (640 dpi). |
| `int` | `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_600` Intermediate density for screens that sit somewhere between `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXHIGH` (480 dpi) and `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXXHIGH` (640 dpi). |
| `int` | `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_DEFAULT` The reference density used throughout the system. |
| `int` | `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_HIGH` Standard quantized DPI for high-density screens. |
| `int` | `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_LOW` Standard quantized DPI for low-density screens. |
| `int` | `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_MEDIUM` Standard quantized DPI for medium-density screens. |
| `int` | `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_TV` This is a secondary density, added for some common screen configurations. |
| `int` | `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XHIGH` Standard quantized DPI for extra-high-density screens. |
| `int` | `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXHIGH` Standard quantized DPI for extra-extra-high-density screens. |
| `int` | `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXXHIGH` Standard quantized DPI for extra-extra-extra-high-density screens. |

| ### Fields ||
|---|---|
| ` public static final int` | `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_DEVICE_STABLE` The device's stable density. |
| ` public float` | `https://developer.android.com/reference/android/util/DisplayMetrics#density` The logical density of the display. |
| ` public int` | `https://developer.android.com/reference/android/util/DisplayMetrics#densityDpi` The screen density expressed as dots-per-inch. |
| ` public int` | `https://developer.android.com/reference/android/util/DisplayMetrics#heightPixels` The absolute height of the available display size in pixels. |
| ` public float` | `https://developer.android.com/reference/android/util/DisplayMetrics#scaledDensity` *This field was deprecated in API level 34. this scalar factor is no longer accurate due to adaptive non-linear font scaling. Please use `https://developer.android.com/reference/android/util/TypedValue#applyDimension(int,%20float,%20android.util.DisplayMetrics)` or `https://developer.android.com/reference/android/util/TypedValue#deriveDimension(int,%20float,%20android.util.DisplayMetrics)` to convert between SP font sizes and pixels.* |
| ` public int` | `https://developer.android.com/reference/android/util/DisplayMetrics#widthPixels` The absolute width of the available display size in pixels. |
| ` public float` | `https://developer.android.com/reference/android/util/DisplayMetrics#xdpi` The exact physical pixels per inch of the screen in the X dimension. |
| ` public float` | `https://developer.android.com/reference/android/util/DisplayMetrics#ydpi` The exact physical pixels per inch of the screen in the Y dimension. |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/util/DisplayMetrics#DisplayMetrics()() ` |

| ### Public methods ||
|---|---|
| ` boolean` | ` https://developer.android.com/reference/android/util/DisplayMetrics#equals(android.util.DisplayMetrics)(https://developer.android.com/reference/android/util/DisplayMetrics other) ` Returns true if these display metrics equal the other display metrics. |
| ` boolean` | ` https://developer.android.com/reference/android/util/DisplayMetrics#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) ` Indicates whether some other object is "equal to" this one. |
| ` int` | ` https://developer.android.com/reference/android/util/DisplayMetrics#hashCode()() ` Returns a hash code value for the object. |
| ` void` | ` https://developer.android.com/reference/android/util/DisplayMetrics#setTo(android.util.DisplayMetrics)(https://developer.android.com/reference/android/util/DisplayMetrics o) ` |
| ` void` | ` https://developer.android.com/reference/android/util/DisplayMetrics#setToDefaults()() ` |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/util/DisplayMetrics#toString()() ` Returns a string representation of the object. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||

## Constants

### DENSITY_140

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DENSITY_140
```

Intermediate density for screens that sit between `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_LOW` (120dpi) and
`https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_MEDIUM` (160dpi). This is not a density that applications should target,
instead relying on the system to scale their `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_MEDIUM` assets for them.

<br />

Constant Value:

140
(0x0000008c)


### DENSITY_180

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DENSITY_180
```

Intermediate density for screens that sit between `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_MEDIUM` (160dpi) and
`https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_HIGH` (240dpi). This is not a density that applications should target,
instead relying on the system to scale their `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_HIGH` assets for them.

<br />

Constant Value:

180
(0x000000b4)


### DENSITY_200

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DENSITY_200
```

Intermediate density for screens that sit between `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_MEDIUM` (160dpi) and
`https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_HIGH` (240dpi). This is not a density that applications should target,
instead relying on the system to scale their `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_HIGH` assets for them.

<br />

Constant Value:

200
(0x000000c8)


### DENSITY_220

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DENSITY_220
```

Intermediate density for screens that sit between `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_MEDIUM` (160dpi) and
`https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_HIGH` (240dpi). This is not a density that applications should target,
instead relying on the system to scale their `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_HIGH` assets for them.

<br />

Constant Value:

220
(0x000000dc)


### DENSITY_260

Added in [API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DENSITY_260
```

Intermediate density for screens that sit between `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_HIGH` (240dpi) and
`https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XHIGH` (320dpi). This is not a density that applications should target,
instead relying on the system to scale their `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XHIGH` assets for them.

<br />

Constant Value:

260
(0x00000104)


### DENSITY_280

Added in [API level 22](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DENSITY_280
```

Intermediate density for screens that sit between `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_HIGH` (240dpi) and
`https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XHIGH` (320dpi). This is not a density that applications should target,
instead relying on the system to scale their `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XHIGH` assets for them.

<br />

Constant Value:

280
(0x00000118)


### DENSITY_300

Added in [API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DENSITY_300
```

Intermediate density for screens that sit between `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_HIGH` (240dpi) and
`https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XHIGH` (320dpi). This is not a density that applications should target,
instead relying on the system to scale their `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XHIGH` assets for them.

<br />

Constant Value:

300
(0x0000012c)


### DENSITY_340

Added in [API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DENSITY_340
```

Intermediate density for screens that sit somewhere between
`https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XHIGH` (320 dpi) and `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXHIGH` (480 dpi).
This is not a density that applications should target, instead relying
on the system to scale their `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXHIGH` assets for them.

<br />

Constant Value:

340
(0x00000154)


### DENSITY_360

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DENSITY_360
```

Intermediate density for screens that sit somewhere between
`https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XHIGH` (320 dpi) and `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXHIGH` (480 dpi).
This is not a density that applications should target, instead relying
on the system to scale their `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXHIGH` assets for them.

<br />

Constant Value:

360
(0x00000168)


### DENSITY_390

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DENSITY_390
```

Intermediate density for screens that sit somewhere between
`https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XHIGH` (320 dpi) and `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXHIGH` (480 dpi).
This is not a density that applications should target, instead relying
on the system to scale their `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXHIGH` assets for them.

<br />

Constant Value:

390
(0x00000186)


### DENSITY_400

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DENSITY_400
```

Intermediate density for screens that sit somewhere between
`https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XHIGH` (320 dpi) and `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXHIGH` (480 dpi).
This is not a density that applications should target, instead relying
on the system to scale their `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXHIGH` assets for them.

<br />

Constant Value:

400
(0x00000190)


### DENSITY_420

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DENSITY_420
```

Intermediate density for screens that sit somewhere between
`https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XHIGH` (320 dpi) and `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXHIGH` (480 dpi).
This is not a density that applications should target, instead relying
on the system to scale their `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXHIGH` assets for them.

<br />

Constant Value:

420
(0x000001a4)


### DENSITY_440

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DENSITY_440
```

Intermediate density for screens that sit somewhere between
`https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XHIGH` (320 dpi) and `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXHIGH` (480 dpi).
This is not a density that applications should target, instead relying
on the system to scale their `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXHIGH` assets for them.

<br />

Constant Value:

440
(0x000001b8)


### DENSITY_450

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DENSITY_450
```

Intermediate density for screens that sit somewhere between
`https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XHIGH` (320 dpi) and `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXHIGH` (480 dpi).
This is not a density that applications should target, instead relying
on the system to scale their `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXHIGH` assets for them.

<br />

Constant Value:

450
(0x000001c2)


### DENSITY_520

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DENSITY_520
```

Intermediate density for screens that sit somewhere between
`https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXHIGH` (480 dpi) and `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXXHIGH` (640 dpi).
This is not a density that applications should target, instead relying
on the system to scale their `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXXHIGH` assets for them.

<br />

Constant Value:

520
(0x00000208)


### DENSITY_560

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DENSITY_560
```

Intermediate density for screens that sit somewhere between
`https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXHIGH` (480 dpi) and `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXXHIGH` (640 dpi).
This is not a density that applications should target, instead relying
on the system to scale their `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXXHIGH` assets for them.

<br />

Constant Value:

560
(0x00000230)


### DENSITY_600

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DENSITY_600
```

Intermediate density for screens that sit somewhere between
`https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXHIGH` (480 dpi) and `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXXHIGH` (640 dpi).
This is not a density that applications should target, instead relying
on the system to scale their `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXXHIGH` assets for them.

<br />

Constant Value:

600
(0x00000258)


### DENSITY_DEFAULT

Added in [API level 4](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DENSITY_DEFAULT
```

The reference density used throughout the system.

<br />

Constant Value:

160
(0x000000a0)


### DENSITY_HIGH

Added in [API level 4](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DENSITY_HIGH
```

Standard quantized DPI for high-density screens.

<br />

Constant Value:

240
(0x000000f0)


### DENSITY_LOW

Added in [API level 4](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DENSITY_LOW
```

Standard quantized DPI for low-density screens.

<br />

Constant Value:

120
(0x00000078)


### DENSITY_MEDIUM

Added in [API level 4](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DENSITY_MEDIUM
```

Standard quantized DPI for medium-density screens.

<br />

Constant Value:

160
(0x000000a0)


### DENSITY_TV

Added in [API level 13](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DENSITY_TV
```

This is a secondary density, added for some common screen configurations.
It is recommended that applications not generally target this as a first
class density -- that is, don't supply specific graphics for this
density, instead allow the platform to scale from other densities
(typically `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_HIGH`) as
appropriate. In most cases (such as using bitmaps in
`https://developer.android.com/reference/android/graphics/drawable/Drawable`) the platform
can perform this scaling at load time, so the only cost is some slight
startup runtime overhead.

This density was original introduced to correspond with a
720p TV screen: the density for 1080p televisions is
`https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XHIGH`, and the value here provides the same UI
size for a TV running at 720p. It has also found use in 7" tablets,
when these devices have 1280x720 displays.

<br />

Constant Value:

213
(0x000000d5)


### DENSITY_XHIGH

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DENSITY_XHIGH
```

Standard quantized DPI for extra-high-density screens.

<br />

Constant Value:

320
(0x00000140)


### DENSITY_XXHIGH

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DENSITY_XXHIGH
```

Standard quantized DPI for extra-extra-high-density screens.

<br />

Constant Value:

480
(0x000001e0)


### DENSITY_XXXHIGH

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DENSITY_XXXHIGH
```

Standard quantized DPI for extra-extra-extra-high-density screens. Applications
should not generally worry about this density; relying on XHIGH graphics
being scaled up to it should be sufficient for almost all cases. A typical
use of this density would be 4K television screens -- 3840x2160, which
is 2x a traditional HD 1920x1080 screen which runs at DENSITY_XHIGH.

<br />

Constant Value:

640
(0x00000280)


## Fields

### DENSITY_DEVICE_STABLE

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DENSITY_DEVICE_STABLE
```

The device's stable density.


This value is constant at run time and may not reflect the current
display density. To obtain the current density for a specific display,
use `https://developer.android.com/reference/android/util/DisplayMetrics#densityDpi`.

<br />

### density

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public float density
```

The logical density of the display. This is a scaling factor for the
Density Independent Pixel unit, where one DIP is one pixel on an
approximately 160 dpi screen (for example a 240x320, 1.5"x2" screen),
providing the baseline of the system's display. Thus on a 160dpi screen
this density value will be 1; on a 120 dpi screen it would be .75; etc.

This value does not exactly follow the real screen size (as given by
`https://developer.android.com/reference/android/util/DisplayMetrics#xdpi` and `https://developer.android.com/reference/android/util/DisplayMetrics#ydpi`), but rather is used to scale the size of
the overall UI in steps based on gross changes in the display dpi. For
example, a 240x320 screen will have a density of 1 even if its width is
1.8", 1.3", etc. However, if the screen resolution is increased to
320x480 but the screen size remained 1.5"x2" then the density would be
increased (probably to 1.5).

<br />

**See also:**

- `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_DEFAULT`

### densityDpi

Added in [API level 4](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int densityDpi
```

The screen density expressed as dots-per-inch. May be any one of the
`DENSITY_` constants defined above.

New constants are frequently added, and constants added on new Android
versions may be backported to previous Android versions, so applications
should not strongly rely on density matching one of the enum constants.


Value is one of the following:

- `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_LOW`
- `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_140`
- `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_MEDIUM`
- `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_180`
- `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_200`
- `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_TV`
- `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_220`
- `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_HIGH`
- `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_260`
- `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_280`
- `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_300`
- `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XHIGH`
- `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_340`
- `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_360`
- `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_390`
- `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_400`
- `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_420`
- `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_440`
- `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_450`
- `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXHIGH`
- `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_520`
- `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_560`
- `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_600`
- `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_XXXHIGH`

### heightPixels

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int heightPixels
```

The absolute height of the available display size in pixels.

<br />

### scaledDensity

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public float scaledDensity
```


**This field was deprecated
in API level 34.**   

this scalar factor is no longer accurate due to adaptive non-linear font scaling.
Please use `https://developer.android.com/reference/android/util/TypedValue#applyDimension(int,%20float,%20android.util.DisplayMetrics)` or
`https://developer.android.com/reference/android/util/TypedValue#deriveDimension(int,%20float,%20android.util.DisplayMetrics)` to convert between SP font
sizes and pixels.

A scaling factor for fonts displayed on the display. This is the same
as `https://developer.android.com/reference/android/util/DisplayMetrics#density`, except that it may be adjusted in smaller
increments at runtime based on a user preference for the font size.

<br />

### widthPixels

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int widthPixels
```

The absolute width of the available display size in pixels.

<br />

### xdpi

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public float xdpi
```

The exact physical pixels per inch of the screen in the X dimension.

<br />

### ydpi

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public float ydpi
```

The exact physical pixels per inch of the screen in the Y dimension.

<br />

## Public constructors

### DisplayMetrics

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public DisplayMetrics ()
```

<br />

<br />

## Public methods

### equals

Added in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean equals (DisplayMetrics other)
```

Returns true if these display metrics equal the other display metrics.

<br />

| Parameters ||
|---|---|
| `other` | `DisplayMetrics`: The display metrics with which to compare. <br /> |

| Returns ||
|---|---|
| `boolean` | True if the display metrics are equal. <br /> |

### equals

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean equals (Object o)
```

Indicates whether some other object is "equal to" this one.


The `equals` method implements an equivalence relation
on non-null object references:

- It is *reflexive*: for any non-null reference value `x`, `x.equals(x)` should return `true`.
- It is *symmetric*: for any non-null reference values `x` and `y`, `x.equals(y)` should return `true` if and only if `y.equals(x)` returns `true`.
- It is *transitive*: for any non-null reference values `x`, `y`, and `z`, if `x.equals(y)` returns `true` and `y.equals(z)` returns `true`, then `x.equals(z)` should return `true`.
- It is *consistent*: for any non-null reference values `x` and `y`, multiple invocations of `x.equals(y)` consistently return `true` or consistently return `false`, provided no information used in `equals` comparisons on the objects is modified.
- For any non-null reference value `x`, `x.equals(null)` should return `false`.


An equivalence relation partitions the elements it operates on
into *equivalence classes*; all the members of an
equivalence class are equal to each other. Members of an
equivalence class are substitutable for each other, at least
for some purposes.

<br />

| Parameters ||
|---|---|
| `o` | `Object`: This value may be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if this object is the same as the obj argument; `false` otherwise. <br /> |

### hashCode

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int hashCode ()
```

Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
`https://developer.android.com/reference/java/util/HashMap`.


The general contract of `hashCode` is:

- Whenever it is invoked on the same object more than once during an execution of a Java application, the `hashCode` method must consistently return the same integer, provided no information used in `equals` comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
- If two objects are equal according to the `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)` method, then calling the `hashCode` method on each of the two objects must produce the same integer result.
- It is *not* required that if two objects are unequal according to the `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)` method, then calling the `hashCode` method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

<br />

<br />

| Returns ||
|---|---|
| `int` | a hash code value for this object. <br /> |

### setTo

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setTo (DisplayMetrics o)
```

<br />

<br />

| Parameters ||
|---|---|
| `o` | `DisplayMetrics` <br /> |

### setToDefaults

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setToDefaults ()
```

<br />

<br />

### toString

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String toString ()
```

Returns a string representation of the object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | a string representation of the object. <br /> |