Guest User

Untitled

a guest
Jan 18th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. public static String getFormattedCurrency(String currencyCode, String currencyName, Number value) {
  2.  
  3. //....
  4.  
  5. NumberFormat format = NumberFormat.getCurrencyInstance(Locale.getDefault());
  6. Currency currency = Currency.getInstance(currencyCode);
  7. format.setCurrency(currency);
  8. if (format instanceof DecimalFormat) {
  9. format.setMinimumFractionDigits(CURRENCY_MIN_FRACTION_DIGITS);
  10. }
  11. Log.d("Currency", "Symbol: " + currency.getSymbol() + ", Currency: " + currency + ", Locale: " + local);
  12. return format.format(value);
  13. }
Add Comment
Please, Sign In to add comment