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/TypedValue#constants) \| [Fields](https://developer.android.com/reference/android/util/TypedValue#lfields) \| [Ctors](https://developer.android.com/reference/android/util/TypedValue#pubctors) \| [Methods](https://developer.android.com/reference/android/util/TypedValue#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/util/TypedValue#inhmethods)

# TypedValue

*** ** * ** ***

` public class TypedValue `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

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

<br />

*** ** * ** ***

Container for a dynamically typed data value. Primarily used with `https://developer.android.com/reference/android/content/res/Resources` for holding resource values.

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_MANTISSA_MASK` Complex data: mask to extract mantissa information (after shifting by `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_MANTISSA_SHIFT`). |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_MANTISSA_SHIFT` Complex data: bit location of mantissa information. |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_RADIX_0p23` Complex data: the mantissa magnitude is 0 bits -- i.e, 0x0.nnnnnn |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_RADIX_16p7` Complex data: the mantissa magnitude is 16 bits -- i.e, 0xnnnn.nn |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_RADIX_23p0` Complex data: the mantissa is an integral number -- i.e., 0xnnnnnn.0 |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_RADIX_8p15` Complex data: the mantissa magnitude is 8 bits -- i.e, 0xnn.nnnn |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_RADIX_MASK` Complex data: mask to extract radix information (after shifting by `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_RADIX_SHIFT`). |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_RADIX_SHIFT` Complex data: where the radix information is, telling where the decimal place appears in the mantissa. |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_DIP` `https://developer.android.com/reference/android/util/TypedValue#TYPE_DIMENSION` complex unit: Value is Device Independent Pixels. |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_FRACTION` `https://developer.android.com/reference/android/util/TypedValue#TYPE_FRACTION` complex unit: A basic fraction of the overall size. |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_FRACTION_PARENT` `https://developer.android.com/reference/android/util/TypedValue#TYPE_FRACTION` complex unit: A fraction of the parent size. |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_IN` `https://developer.android.com/reference/android/util/TypedValue#TYPE_DIMENSION` complex unit: Value is in inches. |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_MASK` Complex data: mask to extract unit information (after shifting by `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_SHIFT`). |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_MM` `https://developer.android.com/reference/android/util/TypedValue#TYPE_DIMENSION` complex unit: Value is in millimeters. |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_PT` `https://developer.android.com/reference/android/util/TypedValue#TYPE_DIMENSION` complex unit: Value is in points. |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_PX` `https://developer.android.com/reference/android/util/TypedValue#TYPE_DIMENSION` complex unit: Value is raw pixels. |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_SHIFT` Complex data: bit location of unit information. |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_SP` `https://developer.android.com/reference/android/util/TypedValue#TYPE_DIMENSION` complex unit: Value is a scaled pixel. |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#DATA_NULL_EMPTY` `https://developer.android.com/reference/android/util/TypedValue#TYPE_NULL` data indicating the value was explicitly set to null. |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#DATA_NULL_UNDEFINED` `https://developer.android.com/reference/android/util/TypedValue#TYPE_NULL` data indicating the value was not specified. |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#DENSITY_DEFAULT` If `https://developer.android.com/reference/android/util/TypedValue#density` is equal to this value, then the density should be treated as the system's default density value: `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_DEFAULT`. |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#DENSITY_NONE` If `https://developer.android.com/reference/android/util/TypedValue#density` is equal to this value, then there is no density associated with the resource and it should not be scaled. |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#TYPE_ATTRIBUTE` The <var translate="no">data</var> field holds an attribute resource identifier (referencing an attribute in the current theme style, not a resource entry). |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#TYPE_DIMENSION` The <var translate="no">data</var> field holds a complex number encoding a dimension value. |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#TYPE_FIRST_COLOR_INT` Identifies the start of integer values that were specified as color constants (starting with '#'). |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#TYPE_FIRST_INT` Identifies the start of plain integer values. |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#TYPE_FLOAT` The <var translate="no">data</var> field holds an IEEE 754 floating point number. |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#TYPE_FRACTION` The <var translate="no">data</var> field holds a complex number encoding a fraction of a container. |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#TYPE_INT_BOOLEAN` `https://developer.android.com/reference/android/util/TypedValue#data` holds 0 to represent `false`, or a value different from 0 to represent `true`. |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#TYPE_INT_COLOR_ARGB4` The <var translate="no">data</var> field holds a color that was originally specified as #argb. |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#TYPE_INT_COLOR_ARGB8` The <var translate="no">data</var> field holds a color that was originally specified as #aarrggbb. |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#TYPE_INT_COLOR_RGB4` The <var translate="no">data</var> field holds a color that was originally specified as #rgb. |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#TYPE_INT_COLOR_RGB8` The <var translate="no">data</var> field holds a color that was originally specified as #rrggbb. |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#TYPE_INT_DEC` The <var translate="no">data</var> field holds a number that was originally specified in decimal. |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#TYPE_INT_HEX` The <var translate="no">data</var> field holds a number that was originally specified in hexadecimal (0xn). |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#TYPE_LAST_COLOR_INT` Identifies the end of integer values that were specified as color constants. |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#TYPE_LAST_INT` Identifies the end of plain integer values. |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#TYPE_NULL` The value contains no data. |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#TYPE_REFERENCE` The <var translate="no">data</var> field holds a resource identifier. |
| `int` | `https://developer.android.com/reference/android/util/TypedValue#TYPE_STRING` The <var translate="no">string</var> field holds string data. |

| ### Fields ||
|---|---|
| ` public int` | `https://developer.android.com/reference/android/util/TypedValue#assetCookie` Additional information about where the value came from; only set for strings. |
| ` public int` | `https://developer.android.com/reference/android/util/TypedValue#changingConfigurations` If the value came from a resource, these are the configurations for which its contents can change. |
| ` public int` | `https://developer.android.com/reference/android/util/TypedValue#data` Basic data in the value, interpreted according to `https://developer.android.com/reference/android/util/TypedValue#type` |
| ` public int` | `https://developer.android.com/reference/android/util/TypedValue#density` If the Value came from a resource, this holds the corresponding pixel density. |
| ` public int` | `https://developer.android.com/reference/android/util/TypedValue#resourceId` If Value came from a resource, this holds the corresponding resource id. |
| ` public int` | `https://developer.android.com/reference/android/util/TypedValue#sourceResourceId` If the Value came from a style resource or a layout resource (set in an XML layout), this holds the corresponding style or layout resource id against which the attribute was resolved. |
| ` public https://developer.android.com/reference/java/lang/CharSequence` | `https://developer.android.com/reference/android/util/TypedValue#string` If the value holds a string, this is it. |
| ` public int` | `https://developer.android.com/reference/android/util/TypedValue#type` The type held by this value, as defined by the constants here. |

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

| ### Public methods ||
|---|---|
| ` static float` | ` https://developer.android.com/reference/android/util/TypedValue#applyDimension(int,%20float,%20android.util.DisplayMetrics)(int unit, float value, https://developer.android.com/reference/android/util/DisplayMetrics metrics) ` Converts an unpacked complex data value holding a dimension to its final floating point pixel value. |
| ` static final https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/util/TypedValue#coerceToString(int,%20int)(int type, int data) ` Perform type conversion as per `https://developer.android.com/reference/android/util/TypedValue#coerceToString()` on an explicitly supplied type and data. |
| ` final https://developer.android.com/reference/java/lang/CharSequence` | ` https://developer.android.com/reference/android/util/TypedValue#coerceToString()() ` Regardless of the actual type of the value, try to convert it to a string value. |
| ` static float` | ` https://developer.android.com/reference/android/util/TypedValue#complexToDimension(int,%20android.util.DisplayMetrics)(int data, https://developer.android.com/reference/android/util/DisplayMetrics metrics) ` Converts a complex data value holding a dimension to its final floating point value. |
| ` static int` | ` https://developer.android.com/reference/android/util/TypedValue#complexToDimensionPixelOffset(int,%20android.util.DisplayMetrics)(int data, https://developer.android.com/reference/android/util/DisplayMetrics metrics) ` Converts a complex data value holding a dimension to its final value as an integer pixel offset. |
| ` static int` | ` https://developer.android.com/reference/android/util/TypedValue#complexToDimensionPixelSize(int,%20android.util.DisplayMetrics)(int data, https://developer.android.com/reference/android/util/DisplayMetrics metrics) ` Converts a complex data value holding a dimension to its final value as an integer pixel size. |
| ` static float` | ` https://developer.android.com/reference/android/util/TypedValue#complexToFloat(int)(int complex) ` Retrieve the base value from a complex data integer. |
| ` static float` | ` https://developer.android.com/reference/android/util/TypedValue#complexToFraction(int,%20float,%20float)(int data, float base, float pbase) ` Converts a complex data value holding a fraction to its final floating point value. |
| ` static float` | ` https://developer.android.com/reference/android/util/TypedValue#convertDimensionToPixels(int,%20float,%20android.util.DisplayMetrics)(int unitToConvertFrom, float value, https://developer.android.com/reference/android/util/DisplayMetrics metrics) ` Converts a dimension value to raw pixels, e.g. DP to PX. |
| ` static float` | ` https://developer.android.com/reference/android/util/TypedValue#convertPixelsToDimension(int,%20float,%20android.util.DisplayMetrics)(int unitToConvertTo, float pixelValue, https://developer.android.com/reference/android/util/DisplayMetrics metrics) ` Converts a pixel value to the given dimension, e.g. PX to DP. |
| ` static float` | ` https://developer.android.com/reference/android/util/TypedValue#deriveDimension(int,%20float,%20android.util.DisplayMetrics)(int unitToConvertTo, float pixelValue, https://developer.android.com/reference/android/util/DisplayMetrics metrics) ` Converts a pixel value to the given dimension, e.g. PX to DP. |
| ` int` | ` https://developer.android.com/reference/android/util/TypedValue#getComplexUnit()() ` Return the complex unit type for this value. |
| ` float` | ` https://developer.android.com/reference/android/util/TypedValue#getDimension(android.util.DisplayMetrics)(https://developer.android.com/reference/android/util/DisplayMetrics metrics) ` Return the data for this value as a dimension. |
| ` final float` | ` https://developer.android.com/reference/android/util/TypedValue#getFloat()() ` Return the data for this value as a float. |
| ` float` | ` https://developer.android.com/reference/android/util/TypedValue#getFraction(float,%20float)(float base, float pbase) ` Return the data for this value as a fraction. |
| ` boolean` | ` https://developer.android.com/reference/android/util/TypedValue#isColorType()() ` Determine if a value is a color. |
| ` void` | ` https://developer.android.com/reference/android/util/TypedValue#setTo(android.util.TypedValue)(https://developer.android.com/reference/android/util/TypedValue other) ` |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/util/TypedValue#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

### COMPLEX_MANTISSA_MASK

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

```
public static final int COMPLEX_MANTISSA_MASK
```

Complex data: mask to extract mantissa information (after shifting by `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_MANTISSA_SHIFT`). This gives us 23 bits of precision; the top bit is the sign.

<br />

Constant Value: 16777215 (0x00ffffff)

### COMPLEX_MANTISSA_SHIFT

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

```
public static final int COMPLEX_MANTISSA_SHIFT
```

Complex data: bit location of mantissa information.

<br />

Constant Value: 8 (0x00000008)

### COMPLEX_RADIX_0p23

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

```
public static final int COMPLEX_RADIX_0p23
```

Complex data: the mantissa magnitude is 0 bits -- i.e, 0x0.nnnnnn

<br />

Constant Value: 3 (0x00000003)

### COMPLEX_RADIX_16p7

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

```
public static final int COMPLEX_RADIX_16p7
```

Complex data: the mantissa magnitude is 16 bits -- i.e, 0xnnnn.nn

<br />

Constant Value: 1 (0x00000001)

### COMPLEX_RADIX_23p0

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

```
public static final int COMPLEX_RADIX_23p0
```

Complex data: the mantissa is an integral number -- i.e., 0xnnnnnn.0

<br />

Constant Value: 0 (0x00000000)

### COMPLEX_RADIX_8p15

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

```
public static final int COMPLEX_RADIX_8p15
```

Complex data: the mantissa magnitude is 8 bits -- i.e, 0xnn.nnnn

<br />

Constant Value: 2 (0x00000002)

### COMPLEX_RADIX_MASK

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

```
public static final int COMPLEX_RADIX_MASK
```

Complex data: mask to extract radix information (after shifting by `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_RADIX_SHIFT`). This give us 4 possible fixed point representations as defined below.

<br />

Constant Value: 3 (0x00000003)

### COMPLEX_RADIX_SHIFT

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

```
public static final int COMPLEX_RADIX_SHIFT
```

Complex data: where the radix information is, telling where the decimal place appears in the mantissa.

<br />

Constant Value: 4 (0x00000004)

### COMPLEX_UNIT_DIP

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

```
public static final int COMPLEX_UNIT_DIP
```

`https://developer.android.com/reference/android/util/TypedValue#TYPE_DIMENSION` complex unit: Value is Device Independent Pixels.

<br />

Constant Value: 1 (0x00000001)

### COMPLEX_UNIT_FRACTION

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

```
public static final int COMPLEX_UNIT_FRACTION
```

`https://developer.android.com/reference/android/util/TypedValue#TYPE_FRACTION` complex unit: A basic fraction of the overall size.

<br />

Constant Value: 0 (0x00000000)

### COMPLEX_UNIT_FRACTION_PARENT

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

```
public static final int COMPLEX_UNIT_FRACTION_PARENT
```

`https://developer.android.com/reference/android/util/TypedValue#TYPE_FRACTION` complex unit: A fraction of the parent size.

<br />

Constant Value: 1 (0x00000001)

### COMPLEX_UNIT_IN

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

```
public static final int COMPLEX_UNIT_IN
```

`https://developer.android.com/reference/android/util/TypedValue#TYPE_DIMENSION` complex unit: Value is in inches.

<br />

Constant Value: 4 (0x00000004)

### COMPLEX_UNIT_MASK

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

```
public static final int COMPLEX_UNIT_MASK
```

Complex data: mask to extract unit information (after shifting by `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_SHIFT`). This gives us 16 possible types, as defined below.

<br />

Constant Value: 15 (0x0000000f)

### COMPLEX_UNIT_MM

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

```
public static final int COMPLEX_UNIT_MM
```

`https://developer.android.com/reference/android/util/TypedValue#TYPE_DIMENSION` complex unit: Value is in millimeters.

<br />

Constant Value: 5 (0x00000005)

### COMPLEX_UNIT_PT

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

```
public static final int COMPLEX_UNIT_PT
```

`https://developer.android.com/reference/android/util/TypedValue#TYPE_DIMENSION` complex unit: Value is in points.

<br />

Constant Value: 3 (0x00000003)

### COMPLEX_UNIT_PX

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

```
public static final int COMPLEX_UNIT_PX
```

`https://developer.android.com/reference/android/util/TypedValue#TYPE_DIMENSION` complex unit: Value is raw pixels.

<br />

Constant Value: 0 (0x00000000)

### COMPLEX_UNIT_SHIFT

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

```
public static final int COMPLEX_UNIT_SHIFT
```

Complex data: bit location of unit information.

<br />

Constant Value: 0 (0x00000000)

### COMPLEX_UNIT_SP

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

```
public static final int COMPLEX_UNIT_SP
```

`https://developer.android.com/reference/android/util/TypedValue#TYPE_DIMENSION` complex unit: Value is a scaled pixel.

<br />

Constant Value: 2 (0x00000002)

### DATA_NULL_EMPTY

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

```
public static final int DATA_NULL_EMPTY
```

`https://developer.android.com/reference/android/util/TypedValue#TYPE_NULL` data indicating the value was explicitly set to null.

<br />

Constant Value: 1 (0x00000001)

### DATA_NULL_UNDEFINED

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

```
public static final int DATA_NULL_UNDEFINED
```

`https://developer.android.com/reference/android/util/TypedValue#TYPE_NULL` data indicating the value was not specified.

<br />

Constant Value: 0 (0x00000000)

### DENSITY_DEFAULT

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

```
public static final int DENSITY_DEFAULT
```

If `https://developer.android.com/reference/android/util/TypedValue#density` is equal to this value, then the density should be treated as the system's default density value: `https://developer.android.com/reference/android/util/DisplayMetrics#DENSITY_DEFAULT`.

<br />

Constant Value: 0 (0x00000000)

### DENSITY_NONE

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

```
public static final int DENSITY_NONE
```

If `https://developer.android.com/reference/android/util/TypedValue#density` is equal to this value, then there is no density associated with the resource and it should not be scaled.

<br />

Constant Value: 65535 (0x0000ffff)

### TYPE_ATTRIBUTE

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

```
public static final int TYPE_ATTRIBUTE
```

The <var translate="no">data</var> field holds an attribute resource identifier (referencing an attribute in the current theme style, not a resource entry).

<br />

Constant Value: 2 (0x00000002)

### TYPE_DIMENSION

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

```
public static final int TYPE_DIMENSION
```

The <var translate="no">data</var> field holds a complex number encoding a dimension value.

<br />

Constant Value: 5 (0x00000005)

### TYPE_FIRST_COLOR_INT

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

```
public static final int TYPE_FIRST_COLOR_INT
```

Identifies the start of integer values that were specified as color constants (starting with '#').

<br />

Constant Value: 28 (0x0000001c)

### TYPE_FIRST_INT

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

```
public static final int TYPE_FIRST_INT
```

Identifies the start of plain integer values. Any type value from this to `https://developer.android.com/reference/android/util/TypedValue#TYPE_LAST_INT` means the <var translate="no">data</var> field holds a generic integer value.

<br />

Constant Value: 16 (0x00000010)

### TYPE_FLOAT

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

```
public static final int TYPE_FLOAT
```

The <var translate="no">data</var> field holds an IEEE 754 floating point number.

<br />

Constant Value: 4 (0x00000004)

### TYPE_FRACTION

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

```
public static final int TYPE_FRACTION
```

The <var translate="no">data</var> field holds a complex number encoding a fraction of a container.

<br />

Constant Value: 6 (0x00000006)

### TYPE_INT_BOOLEAN

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

```
public static final int TYPE_INT_BOOLEAN
```

`https://developer.android.com/reference/android/util/TypedValue#data` holds 0 to represent `false`, or a value different from 0 to represent `true`.

<br />

Constant Value: 18 (0x00000012)

### TYPE_INT_COLOR_ARGB4

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

```
public static final int TYPE_INT_COLOR_ARGB4
```

The <var translate="no">data</var> field holds a color that was originally specified as #argb.

<br />

Constant Value: 30 (0x0000001e)

### TYPE_INT_COLOR_ARGB8

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

```
public static final int TYPE_INT_COLOR_ARGB8
```

The <var translate="no">data</var> field holds a color that was originally specified as #aarrggbb.

<br />

Constant Value: 28 (0x0000001c)

### TYPE_INT_COLOR_RGB4

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

```
public static final int TYPE_INT_COLOR_RGB4
```

The <var translate="no">data</var> field holds a color that was originally specified as #rgb.

<br />

Constant Value: 31 (0x0000001f)

### TYPE_INT_COLOR_RGB8

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

```
public static final int TYPE_INT_COLOR_RGB8
```

The <var translate="no">data</var> field holds a color that was originally specified as #rrggbb.

<br />

Constant Value: 29 (0x0000001d)

### TYPE_INT_DEC

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

```
public static final int TYPE_INT_DEC
```

The <var translate="no">data</var> field holds a number that was originally specified in decimal.

<br />

Constant Value: 16 (0x00000010)

### TYPE_INT_HEX

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

```
public static final int TYPE_INT_HEX
```

The <var translate="no">data</var> field holds a number that was originally specified in hexadecimal (0xn).

<br />

Constant Value: 17 (0x00000011)

### TYPE_LAST_COLOR_INT

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

```
public static final int TYPE_LAST_COLOR_INT
```

Identifies the end of integer values that were specified as color constants.

<br />

Constant Value: 31 (0x0000001f)

### TYPE_LAST_INT

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

```
public static final int TYPE_LAST_INT
```

Identifies the end of plain integer values.

<br />

Constant Value: 31 (0x0000001f)

### TYPE_NULL

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

```
public static final int TYPE_NULL
```

The value contains no data.

<br />

Constant Value: 0 (0x00000000)

### TYPE_REFERENCE

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

```
public static final int TYPE_REFERENCE
```

The <var translate="no">data</var> field holds a resource identifier.

<br />

Constant Value: 1 (0x00000001)

### TYPE_STRING

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

```
public static final int TYPE_STRING
```

The <var translate="no">string</var> field holds string data. In addition, if <var translate="no">data</var> is non-zero then it is the string block index of the string and <var translate="no">assetCookie</var> is the set of assets the string came from.

<br />

Constant Value: 3 (0x00000003)

## Fields

### assetCookie

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

```
public int assetCookie
```

Additional information about where the value came from; only set for strings.

<br />

### changingConfigurations

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

```
public int changingConfigurations
```

If the value came from a resource, these are the configurations for which its contents can change.

For example, if a resource has a value defined for the -land resource qualifier, this field will have the `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_ORIENTATION` bit set.
.   
Value is either `0` or a combination of the following:

- `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_MCC`
- `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_MNC`
- `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_LOCALE`
- `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_TOUCHSCREEN`
- `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_KEYBOARD`
- `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_KEYBOARD_HIDDEN`
- `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_NAVIGATION`
- `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_ORIENTATION`
- `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_SCREEN_LAYOUT`
- `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_UI_MODE`
- `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_SCREEN_SIZE`
- `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_SMALLEST_SCREEN_SIZE`
- `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_DENSITY`
- `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_LAYOUT_DIRECTION`
- `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_COLOR_MODE`
- `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_FONT_SCALE`
- `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_GRAMMATICAL_GENDER`
- `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_FONT_WEIGHT_ADJUSTMENT`
- `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_ASSETS_PATHS`
- `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_RESOURCES_UNUSED`
**See also:**

  - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_MCC`
  - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_MNC`
  - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_LOCALE`
  - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_TOUCHSCREEN`
  - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_KEYBOARD`
  - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_KEYBOARD_HIDDEN`
  - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_NAVIGATION`
  - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_ORIENTATION`
  - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_SCREEN_LAYOUT`
  - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_UI_MODE`
  - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_SCREEN_SIZE`
  - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_SMALLEST_SCREEN_SIZE`
  - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_DENSITY`
  - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_LAYOUT_DIRECTION`
  - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_COLOR_MODE`

### data

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

```
public int data
```

Basic data in the value, interpreted according to `https://developer.android.com/reference/android/util/TypedValue#type`

<br />

### density

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

```
public int density
```

If the Value came from a resource, this holds the corresponding pixel density.

<br />

### resourceId

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

```
public int resourceId
```

If Value came from a resource, this holds the corresponding resource id.

<br />

### sourceResourceId

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

```
public int sourceResourceId
```

If the Value came from a style resource or a layout resource (set in an XML layout), this holds the corresponding style or layout resource id against which the attribute was resolved.

<br />

### string

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

```
public CharSequence string
```

If the value holds a string, this is it.

<br />

### type

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

```
public int type
```

The type held by this value, as defined by the constants here. This tells you how to interpret the other fields in the object.

<br />

## Public constructors

### TypedValue

```
public TypedValue ()
```

<br />

<br />

## Public methods

### applyDimension

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

```
public static float applyDimension (int unit, 
                float value, 
                DisplayMetrics metrics)
```

Converts an unpacked complex data value holding a dimension to its final floating point pixel value. The two parameters <var translate="no">unit</var> and <var translate="no">value</var> are as in `https://developer.android.com/reference/android/util/TypedValue#TYPE_DIMENSION`.

To convert the other way, e.g. from pixels to DP, use `https://developer.android.com/reference/android/util/TypedValue#deriveDimension(int,%20float,%20android.util.DisplayMetrics)`.

<br />

| Parameters ||
|---|---|
| `unit` | `int`: The unit to convert from. Value is one of the following: - `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_PX` - `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_DIP` - `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_SP` - `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_PT` - `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_IN` - `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_MM` |
| `value` | `float`: The value to apply the unit to. <br /> |
| `metrics` | `DisplayMetrics`: Current display metrics to use in the conversion -- supplies display density and scaling information. <br /> |

| Returns ||
|---|---|
| `float` | The equivalent pixel value\\u2014i.e. the complex floating point value multiplied by the appropriate metrics depending on its unit\\u2014or zero if unit is not valid. <br /> |

### coerceToString

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

```
public static final String coerceToString (int type, 
                int data)
```

Perform type conversion as per `https://developer.android.com/reference/android/util/TypedValue#coerceToString()` on an explicitly supplied type and data.

<br />

| Parameters ||
|---|---|
| `type` | `int`: The data type identifier. <br /> |
| `data` | `int`: The data value. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | String The coerced string value. If the value is null or the type is not known, null is returned. <br /> |

### coerceToString

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

```
public final CharSequence coerceToString ()
```

Regardless of the actual type of the value, try to convert it to a string value. For example, a color type will be converted to a string of the form #aarrggbb.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence` | CharSequence The coerced string value. If the value is null or the type is not known, null is returned. <br /> |

### complexToDimension

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

```
public static float complexToDimension (int data, 
                DisplayMetrics metrics)
```

Converts a complex data value holding a dimension to its final floating point value. The given <var translate="no">data</var> must be structured as a `https://developer.android.com/reference/android/util/TypedValue#TYPE_DIMENSION`.

<br />

| Parameters ||
|---|---|
| `data` | `int`: A complex data value holding a unit, magnitude, and mantissa. <br /> |
| `metrics` | `DisplayMetrics`: Current display metrics to use in the conversion -- supplies display density and scaling information. <br /> |

| Returns ||
|---|---|
| `float` | The complex floating point value multiplied by the appropriate metrics depending on its unit. <br /> |

### complexToDimensionPixelOffset

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

```
public static int complexToDimensionPixelOffset (int data, 
                DisplayMetrics metrics)
```

Converts a complex data value holding a dimension to its final value as an integer pixel offset. This is the same as `https://developer.android.com/reference/android/util/TypedValue#complexToDimension(int,%20android.util.DisplayMetrics)`, except the raw floating point value is truncated to an integer (pixel) value. The given <var translate="no">data</var> must be structured as a `https://developer.android.com/reference/android/util/TypedValue#TYPE_DIMENSION`.

<br />

| Parameters ||
|---|---|
| `data` | `int`: A complex data value holding a unit, magnitude, and mantissa. <br /> |
| `metrics` | `DisplayMetrics`: Current display metrics to use in the conversion -- supplies display density and scaling information. <br /> |

| Returns ||
|---|---|
| `int` | The number of pixels specified by the data and its desired multiplier and units. <br /> |

### complexToDimensionPixelSize

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

```
public static int complexToDimensionPixelSize (int data, 
                DisplayMetrics metrics)
```

Converts a complex data value holding a dimension to its final value as an integer pixel size. This is the same as `https://developer.android.com/reference/android/util/TypedValue#complexToDimension(int,%20android.util.DisplayMetrics)`, except the raw floating point value is converted to an integer (pixel) value for use as a size. A size conversion involves rounding the base value, and ensuring that a non-zero base value is at least one pixel in size. The given <var translate="no">data</var> must be structured as a `https://developer.android.com/reference/android/util/TypedValue#TYPE_DIMENSION`.

<br />

| Parameters ||
|---|---|
| `data` | `int`: A complex data value holding a unit, magnitude, and mantissa. <br /> |
| `metrics` | `DisplayMetrics`: Current display metrics to use in the conversion -- supplies display density and scaling information. <br /> |

| Returns ||
|---|---|
| `int` | The number of pixels specified by the data and its desired multiplier and units. <br /> |

### complexToFloat

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

```
public static float complexToFloat (int complex)
```

Retrieve the base value from a complex data integer. This uses the `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_MANTISSA_MASK` and `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_RADIX_MASK` fields of the data to compute a floating point representation of the number they describe. The units are ignored.

<br />

| Parameters ||
|---|---|
| `complex` | `int`: A complex data value. <br /> |

| Returns ||
|---|---|
| `float` | A floating point value corresponding to the complex data. <br /> |

### complexToFraction

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

```
public static float complexToFraction (int data, 
                float base, 
                float pbase)
```

Converts a complex data value holding a fraction to its final floating point value. The given <var translate="no">data</var> must be structured as a `https://developer.android.com/reference/android/util/TypedValue#TYPE_FRACTION`.

<br />

| Parameters ||
|---|---|
| `data` | `int`: A complex data value holding a unit, magnitude, and mantissa. <br /> |
| `base` | `float`: The base value of this fraction. In other words, a standard fraction is multiplied by this value. <br /> |
| `pbase` | `float`: The parent base value of this fraction. In other words, a parent fraction (nn%p) is multiplied by this value. <br /> |

| Returns ||
|---|---|
| `float` | The complex floating point value multiplied by the appropriate base value depending on its unit. <br /> |

### convertDimensionToPixels

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

```
public static float convertDimensionToPixels (int unitToConvertFrom, 
                float value, 
                DisplayMetrics metrics)
```

Converts a dimension value to raw pixels, e.g. DP to PX.

This is just an alias of `https://developer.android.com/reference/android/util/TypedValue#applyDimension(int,%20float,%20android.util.DisplayMetrics)` with an easier-to-find name.

<br />

| Parameters ||
|---|---|
| `unitToConvertFrom` | `int`: The unit to convert from. Value is one of the following: - `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_PX` - `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_DIP` - `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_SP` - `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_PT` - `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_IN` - `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_MM` |
| `value` | `float`: The dimension value to apply the unit to. <br /> |
| `metrics` | `DisplayMetrics`: Current display metrics to use in the conversion -- supplies display density and scaling information. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `float` | The equivalent pixel value\\u2014i.e. the complex floating point value multiplied by the appropriate metrics depending on its unit\\u2014or zero if unit is not valid. <br /> |

### convertPixelsToDimension

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

```
public static float convertPixelsToDimension (int unitToConvertTo, 
                float pixelValue, 
                DisplayMetrics metrics)
```

Converts a pixel value to the given dimension, e.g. PX to DP.

This is just an alias of `https://developer.android.com/reference/android/util/TypedValue#deriveDimension(int,%20float,%20android.util.DisplayMetrics)` with an easier-to-find name.

<br />

| Parameters ||
|---|---|
| `unitToConvertTo` | `int`: The unit to convert to. Value is one of the following: - `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_PX` - `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_DIP` - `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_SP` - `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_PT` - `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_IN` - `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_MM` |
| `pixelValue` | `float`: The raw pixels value to convert from. <br /> |
| `metrics` | `DisplayMetrics`: Current display metrics to use in the conversion -- supplies display density and scaling information. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `float` | A dimension value equivalent to the given number of pixels <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if unitToConvertTo is not valid. |

### deriveDimension

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

```
public static float deriveDimension (int unitToConvertTo, 
                float pixelValue, 
                DisplayMetrics metrics)
```

Converts a pixel value to the given dimension, e.g. PX to DP.

This is the inverse of `https://developer.android.com/reference/android/util/TypedValue#applyDimension(int,%20float,%20android.util.DisplayMetrics)`

<br />

| Parameters ||
|---|---|
| `unitToConvertTo` | `int`: The unit to convert to. Value is one of the following: - `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_PX` - `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_DIP` - `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_SP` - `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_PT` - `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_IN` - `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_MM` |
| `pixelValue` | `float`: The raw pixels value to convert from. <br /> |
| `metrics` | `DisplayMetrics`: Current display metrics to use in the conversion -- supplies display density and scaling information. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `float` | A dimension value equivalent to the given number of pixels <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if unitToConvertTo is not valid. |

### getComplexUnit

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

```
public int getComplexUnit ()
```

Return the complex unit type for this value. For example, a dimen type with value 12sp will return `https://developer.android.com/reference/android/util/TypedValue#COMPLEX_UNIT_SP`. Only use for values whose type is `https://developer.android.com/reference/android/util/TypedValue#TYPE_DIMENSION`.

<br />

| Returns ||
|---|---|
| `int` | The complex unit type. <br /> |

### getDimension

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

```
public float getDimension (DisplayMetrics metrics)
```

Return the data for this value as a dimension. Only use for values whose type is `https://developer.android.com/reference/android/util/TypedValue#TYPE_DIMENSION`.

<br />

| Parameters ||
|---|---|
| `metrics` | `DisplayMetrics`: Current display metrics to use in the conversion -- supplies display density and scaling information. <br /> |

| Returns ||
|---|---|
| `float` | The complex floating point value multiplied by the appropriate metrics depending on its unit. <br /> |

### getFloat

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

```
public final float getFloat ()
```

Return the data for this value as a float. Only use for values whose type is `https://developer.android.com/reference/android/util/TypedValue#TYPE_FLOAT`.

<br />

| Returns ||
|---|---|
| `float` | <br /> |

### getFraction

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

```
public float getFraction (float base, 
                float pbase)
```

Return the data for this value as a fraction. Only use for values whose type is `https://developer.android.com/reference/android/util/TypedValue#TYPE_FRACTION`.

<br />

| Parameters ||
|---|---|
| `base` | `float`: The base value of this fraction. In other words, a standard fraction is multiplied by this value. <br /> |
| `pbase` | `float`: The parent base value of this fraction. In other words, a parent fraction (nn%p) is multiplied by this value. <br /> |

| Returns ||
|---|---|
| `float` | The complex floating point value multiplied by the appropriate base value depending on its unit. <br /> |

### isColorType

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

```
public boolean isColorType ()
```

Determine if a value is a color. This works by comparing `https://developer.android.com/reference/android/util/TypedValue#type` to `https://developer.android.com/reference/android/util/TypedValue#TYPE_FIRST_COLOR_INT` and `https://developer.android.com/reference/android/util/TypedValue#TYPE_LAST_COLOR_INT`.

<br />

| Returns ||
|---|---|
| `boolean` | true if this value is a color <br /> |

### setTo

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

```
public void setTo (TypedValue other)
```

<br />

<br />

| Parameters ||
|---|---|
| `other` | `TypedValue` <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 /> |