我无法理解这段代码中 NumberFormatException 的原因:
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();