views:

33

answers:

0

Hello together,

i try to build an TextEdit (AutocompleteTextView) that format his text with an DecimalFormatter! The TextEdit is set to numeric integer, so only can type numbers. Now i want to format it while writing (or after) to format it like normal money format

like:

public String formatAmount(String currentValue, String loc){
    double db = Double.parseDouble(currentValue);
    String pattern = "###,###.00";
    NumberFormat nf = NumberFormat.getNumberInstance(USD);
    nf = NumberFormat.getNumberInstance(loc);
    DecimalFormat df = (DecimalFormat)nf;
    df.applyPattern(pattern);
    return df.format(db);
}

this formatter works well but i dont know how to use it with the TextEdit?!

example: when i type: 1000 i want to see: 1.000,00 is it possible?

thanks