小编Moh*_*oun的帖子

如何在低api中使用getCurrencyInstance和format?

我在以下代码中收到错误:

private void displayPrice (int number) {

    TextView price = (TextView)findViewById(R.id.txt_price);
    price.setText(NumberFormat.getCurrencyInstance().format(number));
}
Run Code Online (Sandbox Code Playgroud)

我得到的错误如下:

Call requires API level 24 (current min is 14): android.icu.text.NumberFormat#getCurrencyInstance
Run Code Online (Sandbox Code Playgroud)

Android API 24可以使用此功能.我怎样才能在低API中使用它API 15

java android android-debug android-studio android-developer-api

2
推荐指数
1
解决办法
2760
查看次数