UnsupportedOperationException (@DecimalFormatSymbols:getMinusSign:300) {main}
我用阿拉伯语翻译了我的应用程序。 在我的设备上一切正常,但在谷歌分析中,我从阿拉伯用户那里收到了很多这个错误。 在我的设备上,当我将设备设置为阿拉伯语时,一切都有效。
有什么想法吗?
编辑:
DecimalFormatSymbols nf = new DecimalFormatSymbols();
try
{
nf.setDecimalSeparator(sharedPref.getString("pref_currency_decimal_separator", ".").charAt(0));
nf.setGroupingSeparator(sharedPref.getString("pref_currency_thousands_separator", ",").charAt(0));
formatter_currency.setDecimalFormatSymbols(nf);
final int digits = sharedPref.getInt("pref_currency_decimal_places", 2);
formatter_currency.setMaximumFractionDigits(digits);
formatter_currency.setMinimumFractionDigits(digits);
}
catch(IllegalArgumentException e)
{
currency = "$";
nf.setDecimalSeparator('.');
nf.setGroupingSeparator(',');
formatter_currency.setDecimalFormatSymbols(nf);
formatter_currency.setMaximumFractionDigits(2);
formatter_currency.setMinimumFractionDigits(2);
}
catch(UnsupportedOperationException e)
{ }
logcat的:
java.lang.UnsupportedOperationException: Minus sign spans multiple characters: -
at java.text.DecimalFormatSymbols.getMinusSign(DecimalFormatSymbols.java:300)
at java.text.DecimalFormatSymbols.writeObject(DecimalFormatSymbols.java:611)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1033)
at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1384)
at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1651)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1497)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1461)
at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:904)
at java.io.ObjectOutputStream.writeFields(ObjectOutputStream.java:863)
at java.text.DecimalFormat.writeObject(DecimalFormat.java:1129)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1033)
at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1384)
at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1651)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1497)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1461)
at android.os.Parcel.writeSerializable(Parcel.java:1383)
at android.os.Parcel.writeValue(Parcel.java:1335)
at android.os.Parcel.writeArrayMapInternal(Parcel.java:638)
at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1313)
at android.os.Bundle.writeToParcel(Bundle.java:1096)
at android.os.Parcel.writeBundle(Parcel.java:663)
at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:2952)
at android.app.ActivityThread$StopInfo.run(ActivityThread.java:3568)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:155)
at android.app.ActivityThread.main(ActivityThread.java:5696)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1028)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
答案 0 :(得分:0)
问题仅发生在Android API 21之后的rtl语言环境(阿拉伯语,希伯来语等)中。
问题将在下一版本中修复。