Added in API level 30

UnlocalizedNumberFormatter


public class UnlocalizedNumberFormatter
extends NumberFormatterSettings<UnlocalizedNumberFormatter>

java.lang.Object
   ↳ android.icu.number.NumberFormatterSettings<android.icu.number.UnlocalizedNumberFormatter>
     ↳ android.icu.number.UnlocalizedNumberFormatter


A NumberFormatter that does not yet have a locale. In order to format numbers, a locale must be specified. Instances of this class are immutable and thread-safe.

See also:

Summary

Public methods

LocalizedNumberFormatter locale(ULocale locale)

ULocale version of the locale(java.util.Locale) setter above.

LocalizedNumberFormatter locale(Locale locale)

Associate the given locale with the number formatter.

Inherited methods

T decimal(NumberFormatter.DecimalSeparatorDisplay style)

Sets the decimal separator display strategy.

T displayOptions(DisplayOptions displayOptions)

Specifies the DisplayOptions.

boolean equals(Object other)

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

T grouping(NumberFormatter.GroupingStrategy strategy)

Specifies the grouping strategy to use when formatting numbers.

int hashCode()

Returns a hash code value for the object.

T integerWidth(IntegerWidth style)

Specifies the minimum and maximum number of digits to render before the decimal mark.

T notation(Notation notation)

Specifies the notation style (simple, scientific, or compact) for rendering numbers.

T perUnit(MeasureUnit perUnit)

Sets a unit to be used in the denominator.

T precision(Precision precision)

Specifies the rounding precision to use when formatting numbers.

T roundingMode(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(Scale scale)

Sets a scale (multiplier) to be used to scale the number by an arbitrary amount before formatting.

T sign(NumberFormatter.SignDisplay style)

Sets the plus/minus sign display strategy.

T symbols(NumberingSystem ns)

Specifies that the given numbering system should be used when fetching symbols.

T symbols(DecimalFormatSymbols symbols)

Specifies the symbols (decimal separator, grouping separator, percent sign, numerals, etc.) to use when rendering numbers.

T unit(MeasureUnit unit)

Specifies the unit (unit of measure, currency, or percent) to associate with rendered numbers.

T unitWidth(NumberFormatter.UnitWidth style)

Sets the width of the unit (measure unit or currency).

T usage(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.

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

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

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(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(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()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Public methods

locale

Added in API level 30
public LocalizedNumberFormatter locale (ULocale locale)

ULocale version of the locale(java.util.Locale) setter above.

Parameters
locale ULocale: The locale to use when loading data for number formatting.

Returns
LocalizedNumberFormatter The fluent chain

See also:

locale

Added in API level 30
public LocalizedNumberFormatter locale (Locale locale)

Associate the given locale with the number formatter. The locale is used for picking the appropriate symbols, formats, and other data for number display.

To use the Java default locale, call Locale.getDefault():

 NumberFormatter.with(). ... .locale(Locale.getDefault())
 

Parameters
locale Locale: The locale to use when loading data for number formatting.

Returns
LocalizedNumberFormatter The fluent chain