Display currency in Indian rupee format with rupee symbol
Display currency in Indian rupee format with rupee symbol

Display currency in Indian rupee format with rupee symbol

To display currency in Indian rupee format just copy and paste below code and use this function whenever displaying currency.

public static String formatToCurrency(double amount) {
        Locale locale = new Locale("en","IN");
        DecimalFormat decimalFormat = (DecimalFormat) DecimalFormat.getCurrencyInstance(locale);
        DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(locale);
        dfs.setCurrencySymbol("\u20B9");
        decimalFormat.setDecimalFormatSymbols(dfs);
        return decimalFormat.format(amount);
    }