Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
public final class

Currency

extends Object
implements Serializable
java.lang.Object
   ↳ java.util.Currency

Class Overview

A currency corresponding to an ISO 4217 currency code such as "EUR" or "USD".

Summary

Public Methods
static Set < Currency > getAvailableCurrencies ()
Returns a set of all known currencies.
String getCurrencyCode ()
Returns this currency's ISO 4217 currency code.
int getDefaultFractionDigits ()
Returns the default number of fraction digits for this currency.
String getDisplayName ( Locale locale)
Returns the localized name of this currency in the given locale .
String getDisplayName ()
Equivalent to getDisplayName(Locale.getDefault()) .
static Currency getInstance ( Locale locale)
Returns the Currency instance for this Locale 's country.
static Currency getInstance ( String currencyCode)
Returns the Currency instance for the given ISO 4217 currency code.
String getSymbol ( Locale locale)
Returns the localized currency symbol for this currency in locale .
String getSymbol ()
Equivalent to getSymbol(Locale.getDefault()) .
String toString ()
Returns this currency's ISO 4217 currency code.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static Set < Currency > getAvailableCurrencies ()

Returns a set of all known currencies.

public String getCurrencyCode ()

Added in API level 1

Returns this currency's ISO 4217 currency code.

public int getDefaultFractionDigits ()

Added in API level 1

Returns the default number of fraction digits for this currency. For instance, the default number of fraction digits for the US dollar is 2 because there are 100 US cents in a US dollar. For the Japanese Yen, the number is 0 because coins smaller than 1 Yen became invalid in 1953. In the case of pseudo-currencies, such as IMF Special Drawing Rights, -1 is returned.

public String getDisplayName ( Locale locale)

Returns the localized name of this currency in the given locale . Returns the ISO 4217 currency code if no localized name is available.

public String getDisplayName ()

Equivalent to getDisplayName(Locale.getDefault()) . See " Be wary of the default locale ".

public static Currency getInstance ( Locale locale)

Added in API level 1

Returns the Currency instance for this Locale 's country.

Throws
IllegalArgumentException if the locale's country is not a supported ISO 3166 country.

public static Currency getInstance ( String currencyCode)

Added in API level 1

Returns the Currency instance for the given ISO 4217 currency code.

Throws
IllegalArgumentException if the currency code is not a supported ISO 4217 currency code.

public String getSymbol ( Locale locale)

Added in API level 1

Returns the localized currency symbol for this currency in locale . That is, given "USD" and Locale.US, you'd get "$", but given "USD" and a non-US locale, you'd get "US$".

If the locale only specifies a language rather than a language and a country (such as Locale.JAPANESE or {new Locale("en", "")} rather than Locale.JAPAN or {new Locale("en", "US")}), the ISO 4217 currency code is returned.

If there is no locale-specific currency symbol, the ISO 4217 currency code is returned.

public String getSymbol ()

Added in API level 1

Equivalent to getSymbol(Locale.getDefault()) . See " Be wary of the default locale ".

public String toString ()

Added in API level 1

Returns this currency's ISO 4217 currency code.

Returns
  • a printable representation of this object.