此代码工作正常,但如果我更改我的设备语言,这也会显示 Rs 那么获取货币符号的正确方法是什么?
public void displayTotlaPrice() {
TextView totalPriceTextView = (TextView) findViewById(R.id.total_Price);
totalPriceTextView.setText("Rs" + displayCalculatePrice());
}
Run Code Online (Sandbox Code Playgroud)
Locale locale = Locale.getDefault();
Currency currency = Currency.getInstance(locale);
String symbol = currency.getSymbol().replaceAll("\\w", "");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5876 次 |
| 最近记录: |