Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use NumberFormat.getCurrency in Kotlin Android

Tags:

android

kotlin

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?

like image 710
Derek Ribeiro Avatar asked Nov 16 '17 04:11

Derek Ribeiro


3 Answers

use as follows:

private val currencyFormat = NumberFormat.getCurrencyInstance()
like image 50
Gaurav Avatar answered Sep 17 '22 13:09

Gaurav


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

 fun currencyFormat() : NumberFormat = NumberFormat.getCurrencyInstance()
like image 34
Sara Tirmizi Avatar answered Sep 18 '22 13:09

Sara Tirmizi


It can be performed via:

val currencyFormat = NumberFormat.getCurrencyInstance();
like image 27
Zumry Mohamed Avatar answered Sep 19 '22 13:09

Zumry Mohamed