我不明白這個代碼NumberFormatException異常的原因:的Java NumberFormatException的在SimpleDateFormat.getDateInstance()
SimpleDateFormat format = (SimpleDateFormat) SimpleDateFormat.getDateInstance();
下面是我的logcat輸出:
10-30 18:04:05.600: W/System.err(23899): java.lang.NumberFormatException: Invalid int: ""
10-30 18:04:05.600: W/System.err(23899): at java.lang.Integer.invalidInt(Integer.java:138)
10-30 18:04:05.600: W/System.err(23899): at java.lang.Integer.parseInt(Integer.java:359)
10-30 18:04:05.600: W/System.err(23899): at java.lang.Integer.parseInt(Integer.java:332)
10-30 18:04:05.600: W/System.err(23899): at java.util.Calendar.getHwFirstDayOfWeek(Calendar.java:807)
10-30 18:04:05.600: W/System.err(23899): at java.util.Calendar.<init>(Calendar.java:745)
10-30 18:04:05.600: W/System.err(23899): at java.util.GregorianCalendar.<init>(GregorianCalendar.java:338)
10-30 18:04:05.600: W/System.err(23899): at java.util.GregorianCalendar.<init>(GregorianCalendar.java:314)
10-30 18:04:05.608: W/System.err(23899): at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:378)
10-30 18:04:05.608: W/System.err(23899): at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:368)
10-30 18:04:05.608: W/System.err(23899): at java.text.DateFormat.getDateInstance(DateFormat.java:462)
10-30 18:04:05.608: W/System.err(23899): at java.text.DateFormat.getDateInstance(DateFormat.java:443)
10-30 18:04:05.608: W/System.err(23899): at java.text.DateFormat.getDateInstance(DateFormat.java:426)
10-30 18:04:05.608: W/System.err(23899): at com.mycompany.mypackage.InboxFragment$15.setViewValue(InboxFragment.java:396)
編輯: 的DateFormat format = DateFormat.getDateInstance();
此代碼拋出相同的異常'DateFormat format = DateFormat.getDateInstance();' –