我已經能夠在Android模擬器1.5,1.6,2.0和2.1中重現以下行爲:從任何EditText
視圖複製文本「241299999999999999」;去任何日期選擇器(例如:日期&時間設置)並將該值粘貼爲年份或月份。Android:DatePicker中可能存在的錯誤?
使用DatePicker
崩潰,並顯示以下堆棧跟蹤的應用:
10-24 15:50:54.674: E/AndroidRuntime(1012): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime(1012): java.lang.NumberFormatException: unable to parse '241299999999999999' as integer
at java.lang.Integer.parse(Integer.java:390)
at java.lang.Integer.parseInt(Integer.java:374)
at java.lang.Integer.parseInt(Integer.java:333)
at com.android.internal.widget.NumberPicker.getSelectedPos(NumberPicker.java:379)
at com.android.internal.widget.NumberPicker.access$1100(NumberPicker.java:37)
at com.android.internal.widget.NumberPicker$NumberRangeKeyListener.filter(NumberPicker.java:362)
at com.android.internal.widget.NumberPicker$NumberPickerInputFilter.filter(NumberPicker.java:316)
at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:417)
at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:409)
at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:28)
at android.widget.TextView.onTextContextMenuItem(TextView.java:6932)
at android.widget.TextView$MenuHandler.onMenuItemClick(TextView.java:6853)
at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:133)
at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:813)
at com.android.internal.view.menu.MenuDialogHelper.onClick(MenuDialogHelper.java:120)
at com.android.internal.app.AlertController$AlertParams$3.onItemClick(AlertController.java:884)
at android.widget.AdapterView.performItemClick(AdapterView.java:283)
at android.widget.ListView.performItemClick(ListView.java:3132)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:1620)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3948)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
at dalvik.system.NativeStart.main(Native Method)
這是一個已知的bug?
絕對,logcat說「無法解析」241299999999999999'爲整數「! – Huang
我知道它不應該能夠識別它作爲一個整數,但不應該被保護免受這種情況?我認爲在這種情況下崩潰是不是所需的行爲 – pandre