# LocalizedNumberFormatter

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Methods](https://developer.android.com/reference/android/icu/number/LocalizedNumberFormatter#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/icu/number/LocalizedNumberFormatter#inhmethods)  

# LocalizedNumberFormatter

*** ** * ** ***

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

`
public


class
LocalizedNumberFormatter
`  
`


``

extends `[NumberFormatterSettings](https://developer.android.com/reference/android/icu/number/NumberFormatterSettings)`<`[LocalizedNumberFormatter](https://developer.android.com/reference/android/icu/number/LocalizedNumberFormatter)`>


``


`

|---|---|---------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) |||
| ↳ | [android.icu.number.NumberFormatterSettings](https://developer.android.com/reference/android/icu/number/NumberFormatterSettings)\<[android.icu.number.LocalizedNumberFormatter](https://developer.android.com/reference/android/icu/number/LocalizedNumberFormatter)\> ||
|   | ↳ | android.icu.number.LocalizedNumberFormatter |

<br />

*** ** * ** ***

A NumberFormatter that has a locale associated with it; this means .format() methods are available. Instances of this class are immutable and thread-safe.  
**See also:**

- [NumberFormatter](https://developer.android.com/reference/android/icu/number/NumberFormatter)
- [NumberFormatter](https://developer.android.com/reference/android/icu/number/NumberFormatter)

## Summary

|                                                                                                                                                                                                                                                                                                                               ### Public methods                                                                                                                                                                                                                                                                                                                               ||
|------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[FormattedNumber](https://developer.android.com/reference/android/icu/number/FormattedNumber)                       | ` `[format](https://developer.android.com/reference/android/icu/number/LocalizedNumberFormatter#format(double))`(double input) ` Format the given float or double to a string using the settings specified in the NumberFormatter fluent setting chain.                                                                                                                                                                                                                                                                                                |
| ` `[FormattedNumber](https://developer.android.com/reference/android/icu/number/FormattedNumber)                       | ` `[format](https://developer.android.com/reference/android/icu/number/LocalizedNumberFormatter#format(android.icu.util.Measure))`(`[Measure](https://developer.android.com/reference/android/icu/util/Measure)` input) ` Format the given[Measure](https://developer.android.com/reference/android/icu/util/Measure)or[CurrencyAmount](https://developer.android.com/reference/android/icu/util/CurrencyAmount)to a string using the settings specified in the NumberFormatter fluent setting chain.                                                  |
| ` `[FormattedNumber](https://developer.android.com/reference/android/icu/number/FormattedNumber)                       | ` `[format](https://developer.android.com/reference/android/icu/number/LocalizedNumberFormatter#format(long))`(long input) ` Format the given byte, short, int, or long to a string using the settings specified in the NumberFormatter fluent setting chain.                                                                                                                                                                                                                                                                                          |
| ` `[FormattedNumber](https://developer.android.com/reference/android/icu/number/FormattedNumber)                       | ` `[format](https://developer.android.com/reference/android/icu/number/LocalizedNumberFormatter#format(java.lang.Number))`(`[Number](https://developer.android.com/reference/java/lang/Number)` input) ` Format the given[BigInteger](https://developer.android.com/reference/java/math/BigInteger),[BigDecimal](https://developer.android.com/reference/android/icu/math/BigDecimal), or other[Number](https://developer.android.com/reference/java/lang/Number)to a string using the settings specified in the NumberFormatter fluent setting chain. |
| ` `[Format](https://developer.android.com/reference/java/text/Format)                                                  | ` `[toFormat](https://developer.android.com/reference/android/icu/number/LocalizedNumberFormatter#toFormat())`() ` Creates a representation of this LocalizedNumberFormat as a[Format](https://developer.android.com/reference/java/text/Format), enabling the use of this number formatter with APIs that need an object of that type, such as MessageFormat.                                                                                                                                                                                         |
| ` `[UnlocalizedNumberFormatter](https://developer.android.com/reference/android/icu/number/UnlocalizedNumberFormatter) | ` `[withoutLocale](https://developer.android.com/reference/android/icu/number/LocalizedNumberFormatter#withoutLocale())`() ` Disassociate the locale from this formatter.                                                                                                                                                                                                                                                                                                                                                                              |

| ### Inherited methods |
|-----------------------|---|
| From class` `[android.icu.number.NumberFormatterSettings](https://developer.android.com/reference/android/icu/number/NumberFormatterSettings)` ` |------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` T`       | ` `[decimal](https://developer.android.com/reference/android/icu/number/NumberFormatterSettings#decimal(android.icu.number.NumberFormatter.DecimalSeparatorDisplay))`(`[NumberFormatter.DecimalSeparatorDisplay](https://developer.android.com/reference/android/icu/number/NumberFormatter.DecimalSeparatorDisplay)` style) ` Sets the decimal separator display strategy.                                     | | ` T`       | ` `[displayOptions](https://developer.android.com/reference/android/icu/number/NumberFormatterSettings#displayOptions(android.icu.text.DisplayOptions))`(`[DisplayOptions](https://developer.android.com/reference/android/icu/text/DisplayOptions)` displayOptions) ` Specifies the`DisplayOptions`.                                                                                                           | | ` boolean` | ` `[equals](https://developer.android.com/reference/android/icu/number/NumberFormatterSettings#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` other) ` Indicates whether some other object is "equal to" this one.                                                                                                                                             | | ` T`       | ` `[grouping](https://developer.android.com/reference/android/icu/number/NumberFormatterSettings#grouping(android.icu.number.NumberFormatter.GroupingStrategy))`(`[NumberFormatter.GroupingStrategy](https://developer.android.com/reference/android/icu/number/NumberFormatter.GroupingStrategy)` strategy) ` Specifies the grouping strategy to use when formatting numbers.                                  | | ` int`     | ` `[hashCode](https://developer.android.com/reference/android/icu/number/NumberFormatterSettings#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                                                                                                                     | | ` T`       | ` `[integerWidth](https://developer.android.com/reference/android/icu/number/NumberFormatterSettings#integerWidth(android.icu.number.IntegerWidth))`(`[IntegerWidth](https://developer.android.com/reference/android/icu/number/IntegerWidth)` style) ` Specifies the minimum and maximum number of digits to render before the decimal mark.                                                                   | | ` T`       | ` `[notation](https://developer.android.com/reference/android/icu/number/NumberFormatterSettings#notation(android.icu.number.Notation))`(`[Notation](https://developer.android.com/reference/android/icu/number/Notation)` notation) ` Specifies the notation style (simple, scientific, or compact) for rendering numbers.                                                                                     | | ` T`       | ` `[perUnit](https://developer.android.com/reference/android/icu/number/NumberFormatterSettings#perUnit(android.icu.util.MeasureUnit))`(`[MeasureUnit](https://developer.android.com/reference/android/icu/util/MeasureUnit)` perUnit) ` Sets a unit to be used in the denominator.                                                                                                                             | | ` T`       | ` `[precision](https://developer.android.com/reference/android/icu/number/NumberFormatterSettings#precision(android.icu.number.Precision))`(`[Precision](https://developer.android.com/reference/android/icu/number/Precision)` precision) ` Specifies the rounding precision to use when formatting numbers.                                                                                                   | | ` T`       | ` `[roundingMode](https://developer.android.com/reference/android/icu/number/NumberFormatterSettings#roundingMode(java.math.RoundingMode))`(`[RoundingMode](https://developer.android.com/reference/java/math/RoundingMode)` roundingMode) ` Specifies how to determine the direction to round a number when it has more digits than fit in the desired precision.                                              | | ` T`       | ` `[scale](https://developer.android.com/reference/android/icu/number/NumberFormatterSettings#scale(android.icu.number.Scale))`(`[Scale](https://developer.android.com/reference/android/icu/number/Scale)` scale) ` Sets a scale (multiplier) to be used to scale the number by an arbitrary amount before formatting.                                                                                         | | ` T`       | ` `[sign](https://developer.android.com/reference/android/icu/number/NumberFormatterSettings#sign(android.icu.number.NumberFormatter.SignDisplay))`(`[NumberFormatter.SignDisplay](https://developer.android.com/reference/android/icu/number/NumberFormatter.SignDisplay)` style) ` Sets the plus/minus sign display strategy.                                                                                 | | ` T`       | ` `[symbols](https://developer.android.com/reference/android/icu/number/NumberFormatterSettings#symbols(android.icu.text.NumberingSystem))`(`[NumberingSystem](https://developer.android.com/reference/android/icu/text/NumberingSystem)` ns) ` Specifies that the given numbering system should be used when fetching symbols.                                                                                 | | ` T`       | ` `[symbols](https://developer.android.com/reference/android/icu/number/NumberFormatterSettings#symbols(android.icu.text.DecimalFormatSymbols))`(`[DecimalFormatSymbols](https://developer.android.com/reference/android/icu/text/DecimalFormatSymbols)` symbols) ` Specifies the symbols (decimal separator, grouping separator, percent sign, numerals, etc.) to use when rendering numbers.                  | | ` T`       | ` `[unit](https://developer.android.com/reference/android/icu/number/NumberFormatterSettings#unit(android.icu.util.MeasureUnit))`(`[MeasureUnit](https://developer.android.com/reference/android/icu/util/MeasureUnit)` unit) ` Specifies the unit (unit of measure, currency, or percent) to associate with rendered numbers.                                                                                  | | ` T`       | ` `[unitWidth](https://developer.android.com/reference/android/icu/number/NumberFormatterSettings#unitWidth(android.icu.number.NumberFormatter.UnitWidth))`(`[NumberFormatter.UnitWidth](https://developer.android.com/reference/android/icu/number/NumberFormatter.UnitWidth)` style) ` Sets the width of the unit (measure unit or currency).                                                                 | | ` T`       | ` `[usage](https://developer.android.com/reference/android/icu/number/NumberFormatterSettings#usage(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` usage) ` Specifies the usage for which numbers will be formatted ("person-height", "road", "rainfall", etc.) When a`usage`is specified, the output unit will change depending on the`Locale`and the unit quantity. | ||
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](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 `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](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`                                                                  | ` `[wait](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`                                                                  | ` `[wait](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*.                                                                                             | ||

## Public methods

### format

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

```
public FormattedNumber format (double input)
```

Format the given float or double to a string using the settings specified in the NumberFormatter fluent setting chain.

<br />

|                   Parameters                    ||
|---------|----------------------------------------|
| `input` | `double`: The number to format. <br /> |

|                                                                               Returns                                                                               ||
|-----------------------------------------------------------------------------------------------|----------------------------------------------------------------------|
| [FormattedNumber](https://developer.android.com/reference/android/icu/number/FormattedNumber) | A FormattedNumber object; call .toString() to get the string. <br /> |

**See also:**

- [NumberFormatter](https://developer.android.com/reference/android/icu/number/NumberFormatter)  

### format

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

```
public FormattedNumber format (Measure input)
```

Format the given[Measure](https://developer.android.com/reference/android/icu/util/Measure)or[CurrencyAmount](https://developer.android.com/reference/android/icu/util/CurrencyAmount)to a string using the settings specified in the NumberFormatter fluent setting chain.

The unit specified here overrides any unit that may have been specified in the setter chain. This method is intended for cases when each input to the number formatter has a different unit.

<br />

|                    Parameters                    ||
|---------|-----------------------------------------|
| `input` | `Measure`: The number to format. <br /> |

|                                                                               Returns                                                                               ||
|-----------------------------------------------------------------------------------------------|----------------------------------------------------------------------|
| [FormattedNumber](https://developer.android.com/reference/android/icu/number/FormattedNumber) | A FormattedNumber object; call .toString() to get the string. <br /> |

**See also:**

- [NumberFormatter](https://developer.android.com/reference/android/icu/number/NumberFormatter)  

### format

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

```
public FormattedNumber format (long input)
```

Format the given byte, short, int, or long to a string using the settings specified in the NumberFormatter fluent setting chain.

<br />

|                  Parameters                   ||
|---------|--------------------------------------|
| `input` | `long`: The number to format. <br /> |

|                                                                               Returns                                                                               ||
|-----------------------------------------------------------------------------------------------|----------------------------------------------------------------------|
| [FormattedNumber](https://developer.android.com/reference/android/icu/number/FormattedNumber) | A FormattedNumber object; call .toString() to get the string. <br /> |

**See also:**

- [NumberFormatter](https://developer.android.com/reference/android/icu/number/NumberFormatter)  

### format

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

```
public FormattedNumber format (Number input)
```

Format the given[BigInteger](https://developer.android.com/reference/java/math/BigInteger),[BigDecimal](https://developer.android.com/reference/android/icu/math/BigDecimal), or other[Number](https://developer.android.com/reference/java/lang/Number)to a string using the settings specified in the NumberFormatter fluent setting chain.

<br />

|                   Parameters                    ||
|---------|----------------------------------------|
| `input` | `Number`: The number to format. <br /> |

|                                                                               Returns                                                                               ||
|-----------------------------------------------------------------------------------------------|----------------------------------------------------------------------|
| [FormattedNumber](https://developer.android.com/reference/android/icu/number/FormattedNumber) | A FormattedNumber object; call .toString() to get the string. <br /> |

**See also:**

- [NumberFormatter](https://developer.android.com/reference/android/icu/number/NumberFormatter)  

### toFormat

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

```
public Format toFormat ()
```

Creates a representation of this LocalizedNumberFormat as a[Format](https://developer.android.com/reference/java/text/Format), enabling the use of this number formatter with APIs that need an object of that type, such as MessageFormat.

This API is not intended to be used other than for enabling API compatibility. The[format(Measure)](https://developer.android.com/reference/android/icu/number/LocalizedNumberFormatter#format(android.icu.util.Measure))methods should normally be used when formatting numbers, not the Format object returned by this method.

<br />

|                                                           Returns                                                           ||
|--------------------------------------------------------------------|---------------------------------------------------------|
| [Format](https://developer.android.com/reference/java/text/Format) | A Format wrapping this LocalizedNumberFormatter. <br /> |

**See also:**

- [NumberFormatter](https://developer.android.com/reference/android/icu/number/NumberFormatter)  

### withoutLocale

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

```
public UnlocalizedNumberFormatter withoutLocale ()
```

Disassociate the locale from this formatter.

<br />

|                                                                    Returns                                                                    ||
|---------------------------------------------------------------------------------------------------------------------|--------------------------|
| [UnlocalizedNumberFormatter](https://developer.android.com/reference/android/icu/number/UnlocalizedNumberFormatter) | The fluent chain. <br /> |