Format Variable Int in currency R $ in Android

-1

I use the Maskformatter lib to format Edittext fields. But now I'm getting a value from an int variable and I wanted to format it in the R $ currency value.

Example: In the variable containing 1000 Format: 10.00

Using the lib I can not because it only accepts EditText.

I'm using the result of this variable and displaying it in a TextView.

    
asked by anonymous 26.07.2017 / 16:49

1 answer

0

Well I managed to solve it after a good deal

I used

NumberFormat nf = NumberFormat.getCurrencyInstance();

and in the TextView variable

nf.format(valortotal / 100)

result in what I really wanted R$34,00 ou R$10,00

By what I understood using NumberFormat.getCurrencyInstance() it takes the formatting of the system, be it BR or EN.

    
26.07.2017 / 18:54