Java Code Examples for android.icu.text.NumberFormat#clone()

The following examples show how to use android.icu.text.NumberFormat#clone() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GlobalizationPreferences.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * Sets a number format explicitly. Overrides the general locale settings.
 *
 * @param style NF_NUMBER, NF_CURRENCY, NF_PERCENT, NF_SCIENTIFIC, NF_INTEGER
 * @param format The number format
 * @return this, for chaining
 * @hide draft / provisional / internal are hidden on Android
 */
public GlobalizationPreferences setNumberFormat(int style, NumberFormat format) {
    if (isFrozen()) {
        throw new UnsupportedOperationException("Attempt to modify immutable object");
    }
    if (numberFormats == null) {
        numberFormats = new NumberFormat[NF_LIMIT];
    }
    numberFormats[style] = (NumberFormat) format.clone(); // for safety
    return this;
}