不支持ISO 4217货币代码:GBP

时间:2013-02-03 12:51:22

标签: java android

如何使用货币提取货币符号,就像字符串“GBP”我正在使用

String s = obj.getCurrency().toString();
Currency currency=Currency.getInstance(s);

但它抛出了这个例外:

01-31 11:40:40.464: E/AndroidRuntime(3929): FATAL EXCEPTION: main
01-31 11:40:40.464: E/AndroidRuntime(3929): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.primesoft.games.potshot/com.primesoft.games.potshot.PotshotActivity}: java.lang.IllegalArgumentException: Not a supported ISO 4217 currency code: GBP 
01-31 11:40:40.464: E/AndroidRuntime(3929):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
01-31 11:40:40.464: E/AndroidRuntime(3929):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
01-31 11:40:40.464: E/AndroidRuntime(3929):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
01-31 11:40:40.464: E/AndroidRuntime(3929):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
01-31 11:40:40.464: E/AndroidRuntime(3929):     at android.os.Handler.dispatchMessage(Handler.java:99)
01-31 11:40:40.464: E/AndroidRuntime(3929):     at android.os.Looper.loop(Looper.java:130)
01-31 11:40:40.464: E/AndroidRuntime(3929):     at android.app.ActivityThread.main(ActivityThread.java:3683)
01-31 11:40:40.464: E/AndroidRuntime(3929):     at java.lang.reflect.Method.invokeNative(Native Method)
01-31 11:40:40.464: E/AndroidRuntime(3929):     at java.lang.reflect.Method.invoke(Method.java:507)
01-31 11:40:40.464: E/AndroidRuntime(3929):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)

0 个答案:

没有答案