Use NumberFormat.getCurrency in Kotlin Android

Viewed 4008

I need call this

{private static final NumberFormat currencyFormat = NumberFormat.getCurrencyInstance();}

in Android Application, but I using Kotlin and I don't know how to do that in Kotlin. How can I do this in Kotlin?

3 Answers

use as follows:

private val currencyFormat = NumberFormat.getCurrencyInstance()

It can be performed via:

val currencyFormat = NumberFormat.getCurrencyInstance();

use below method it will return currency format of the current default format locale:

 fun currencyFormat() : NumberFormat = NumberFormat.getCurrencyInstance()
Related