UnsupportedOperationException (@DecimalFormatSymbols:getMinusSign:300) {main}
I've translated my app in arabic. On my devices all is ok, but in Google Analytics I received a lot of this error from arabic users. On my device all works also when I set my devices into arabic.
Any ideas?
EDIT:
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)
The problem happen only in rtl locales (arabic, hebrew, etc.) after android API 21.
The problem will be fixed in the next releases.
https://code.google.com/p/android/issues/detail?id=170718