2

I am trying to add currency symbol with the cost using Transformations of Live Data object, but it is not importing.

private val _price = MutableLiveData<Double>()
val price: LiveData<String> = Transformations.map(_price) {
   NumberFormat.getCurrencyInstance().format(it)
}

Please debug

  • Which version of the androidx.lifecycle library are you using? If it's 2.6.0 or newer then you should replace `Transformations.map(_price) { }` with `_price.map { }`. See [the changelog](https://developer.android.com/jetpack/androidx/releases/lifecycle#2.6.0) for version 2.6.0. – Michael Jun 28 '23 at 09:00

0 Answers0