#StackBounty: #java #android #localization #currency Why Currency.defaultFractionDigits() for IDR is 0 for android?

Bounty: 50

For Indonesian currency (IDR), defaultFractionDigits() gives me 0 in Android app.

Locale locale = new Locale("in", "ID");
Currency currency = Currency.getInstance(locale);
Log.d("TEST",String.format(locale, "Currency - %s ( %s )  Decimal - %s ",
        currency.getSymbol(locale),
        currency.getSymbol(),
        currency.getDefaultFractionDigits()));

D/TEST: Currency – Rp ( IDR ) Decimal – 0

Same gives me 2 when I’m testing it in my eclipse (also in RexTester)

Locale.setDefault(new Locale("in","ID"));
Currency c = Currency.getInstance("IDR");
System.out.println("Symbol: " + c.getSymbol());
System.out.println("Default fractional digits: " + c.getDefaultFractionDigits());

Symbol: Rp

Default fractional digits: 2

Documentation of both Android & Java states that it’s ISO 4217 (ISO 4217:2015 lists the IDR with two-digit decimal points)

Why it’s 0 for Android App?


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.