我有我的调试code的一个问题。我收到 java.lang.NumberFormatException:无效INT:
误差线88这是日历C = Calendar.getInstance();
。我不'明白是怎么日历
实例会产生这样的错误。
WakefulReceiverWorker.java:
日历C = Calendar.getInstance(); //< -----行88
长NEWSTART = c.getTimeInMillis()+ 300000;
AlarmManager mAlarmManager =(AlarmManager)getSystemService(Context.ALARM_SERVICE);
PendingIntent pendingIntent = PendingIntent.getBroadcast(这一点,randomInt,intent2,PendingIntent.FLAG_UPDATE_CURRENT);
mAlarmManager.set(AlarmManager.RTC_WAKEUP,(新起点),pendingIntent);
logcat的:
12-13 19:57:01.589 2070至85年/ com.example.app W / System.err的:java.lang.NumberFormatException:无效INT:
12-13日19:57:01.619 2070年至二〇八五年/ com.example.app W / System.err的:在java.lang.Integer.invalidInt(Integer.java:138)
12-13日19:57:01.629 2070年至二〇八五年/ com.example.app W / System.err的:在java.lang.Integer.parseInt(Integer.java:359)
12-13日19:57:01.639 2070年至二〇八五年/ com.example.app W / System.err的:在java.lang.Integer.parseInt(Integer.java:332)
12-13日19:57:01.639 2070年至二〇八五年/ com.example.app W / System.err的:在java.util.Calendar.getHwFirstDayOfWeek(Calendar.java:807)
12-13日19:57:01.639 2070年至二〇八五年/ com.example.app W / System.err的:在java.util.Calendar中所述&;初始化>(Calendar.java:745)
12-13日19:57:01.639 2070年至二〇八五年/ com.example.app W / System.err的:在java.util.GregorianCalendar中所述&;初始化>(GregorianCalendar.java:338)
12-13日19:57:01.649 2070年至二〇八五年/ com.example.app W / System.err的:在java.util.GregorianCalendar中所述&;初始化>(GregorianCalendar.java:239)
12-13日19:57:01.649 2070年至二〇八五年/ com.example.app W / System.err的:在java.util.Calendar.getInstance(Calendar.java:1086)
12-13日19:57:01.649 2070年至二〇八五年/ com.example.app W / System.err的:在com.example.app.WakefulReceiverWorker.onHandleIntent(WakefulReceiverWorker.java:88)
12-13日19:57:01.659 2070年至二〇八五年/ com.example.app W / System.err的:在android.app.IntentService $ ServiceHandler.handleMessage(IntentService.java:65)
12-13日19:57:01.659 2070年至二〇八五年/ com.example.app W / System.err的:在android.os.Handler.dispatchMessage(Handler.java:99)
12-13日19:57:01.659 2070年至二〇八五年/ com.example.app W / System.err的:在android.os.Looper.loop(Looper.java:137)
12-13日19:57:01.659 2070年至二〇八五年/ com.example.app W / System.err的:在android.os.HandlerThread.run(HandlerThread.java:60)
解决方案
我刚刚测试了三星Galaxy S3(I9300)和错误的应用程序不在此设备上present。看来,这是华为的软件问题。
I have a problem with debugging my code. I'm getting java.lang.NumberFormatException: Invalid int: ""
error at line 88 which is Calendar c = Calendar.getInstance();
. I dont' understand how the Calendar
instance can produce such error.
WakefulReceiverWorker.java:
Calendar c = Calendar.getInstance(); // <----- line 88
long newStart = c.getTimeInMillis() + 300000;
AlarmManager mAlarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, randomInt, intent2,PendingIntent.FLAG_UPDATE_CURRENT);
mAlarmManager.set(AlarmManager.RTC_WAKEUP, (newStart), pendingIntent);
logcat:
12-13 19:57:01.589 2070-2085/com.example.app W/System.err﹕ java.lang.NumberFormatException: Invalid int: ""
12-13 19:57:01.619 2070-2085/com.example.app W/System.err﹕ at java.lang.Integer.invalidInt(Integer.java:138)
12-13 19:57:01.629 2070-2085/com.example.app W/System.err﹕ at java.lang.Integer.parseInt(Integer.java:359)
12-13 19:57:01.639 2070-2085/com.example.app W/System.err﹕ at java.lang.Integer.parseInt(Integer.java:332)
12-13 19:57:01.639 2070-2085/com.example.app W/System.err﹕ at java.util.Calendar.getHwFirstDayOfWeek(Calendar.java:807)
12-13 19:57:01.639 2070-2085/com.example.app W/System.err﹕ at java.util.Calendar.<init>(Calendar.java:745)
12-13 19:57:01.639 2070-2085/com.example.app W/System.err﹕ at java.util.GregorianCalendar.<init>(GregorianCalendar.java:338)
12-13 19:57:01.649 2070-2085/com.example.app W/System.err﹕ at java.util.GregorianCalendar.<init>(GregorianCalendar.java:239)
12-13 19:57:01.649 2070-2085/com.example.app W/System.err﹕ at java.util.Calendar.getInstance(Calendar.java:1086)
12-13 19:57:01.649 2070-2085/com.example.app W/System.err﹕ at com.example.app.WakefulReceiverWorker.onHandleIntent(WakefulReceiverWorker.java:88)
12-13 19:57:01.659 2070-2085/com.example.app W/System.err﹕ at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
12-13 19:57:01.659 2070-2085/com.example.app W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:99)
12-13 19:57:01.659 2070-2085/com.example.app W/System.err﹕ at android.os.Looper.loop(Looper.java:137)
12-13 19:57:01.659 2070-2085/com.example.app W/System.err﹕ at android.os.HandlerThread.run(HandlerThread.java:60)
解决方案
I've just tested the app on the Samsung Galaxy S3 (i9300) and the error is not present on this device. It seems that it is Huawei's software problem.