有时输入十进制值我得到NumberFormatException,因为我有限制逗号(,)

时间:2015-03-09 15:27:40

标签: android

虽然输入小数值有时我得到NumberFormatException,因为我限制了逗号(,)。在Crash Analytics中,它显示逗号而不是点,即使我已经用点(。)替换了逗号(,)。

例如:

.{main} java.lang.NumberFormatException: Invalid double: "1,00" at 
java.lang.StringToReal.invalidReal(StringToReal.java:63) at 
java.lang.StringToReal.parseDouble(StringToReal.java:269) at 
java.lang.Double.parseDouble(Double.java:295) at 
PackageName.ActivityName.MethodOne(ActivityName.java:112) at 
PackageName.AnotherActivityName.onClick(AnotherActivityName.java:197) at 
android.view.View.performClick(View.java:4640) at 
android.view.View$PerformClick.run(View.java:19421) at 
android.os.Handler.handleCallback(Handler.java:733) at 
android.os.Handler.dispatchMessage(Handler.java:95) at 
android.os.Looper.loop(Looper.java:136) at 
android.app.ActivityThread.main(ActivityThread.java:5476) at 
java.lang.reflect.Method.invokeNative(Native Method) at 
java.lang.reflect.Method.invoke(Method.java:515) at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283) at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099) at 
dalvik.system.NativeStart.main(Native Method) 

0 个答案:

没有答案