最近我的应用程序崩溃真的很奇怪,如果我启动应用程序,它会提供一秒钟或10秒的白屏,而不是停止工作。
logcat出现以下错误,但我不明白,你们可以帮助我吗?
错误日志太大,请在pastebin上查看: Error log
EDIT ------------------
我认为这段代码会生成错误,它在我添加之后开始: 我只是不确定错误是什么,我不明白logcat输出
{
Calendar cal = loadCurrentCalendar();
long currentMil = cal.getTimeInMillis();
int hourI = cal.HOUR_OF_DAY;
while (hourI <19)
{
currentMil = currentMil + ONE_HOUR;
hourI ++;
}
setSleepMil(currentMil + SLEEP_TIME); // TODO werkt dit ? + SLEEP_TIME stond hier achter currentMil
return getSleepMil();
}
public int hourPassedSleepCur(long sleepMil)
{
Calendar cal = loadCurrentCalendar();
long currentMil = cal.getTimeInMillis();
hoursPassed = 0;
while (sleepMil < currentMil)
{
hoursPassed ++;
setSleepMil(getSleepMil()+ ONE_HOUR);
}
return hoursPassed;
}
}
EDIT 2-------------------------------------------
Im accessing it with this piece of code witch runs in a thread that checks every few milisec
public void checkSleepyTime()
{
currentCalendar = timeHelper.loadCurrentCalendar();
int hour = currentCalendar.get(Calendar.HOUR_OF_DAY);
int daypart = currentCalendar.get(Calendar.AM_PM);
if (hour >= 20 && daypart == 1 || hour < 6 && daypart == 0)
{
foodButton.setText("ZZzz");
prefs.edit().remove("foodTime").commit();
buddy.setSleeping(true);
}
else
{
buddy.setFoodLevel(buddy.getFoodLevel() - timeHelper.hourPassedSleepCur(loadNextSleepyTime()));
// buttonTest.setText(timeHelper.hourPassedSleepCur(getNextSleepyTime()));
saveNextSleepyTime();
sleepTimeView.setText("sleepy at: " + String.valueOf(loadNextSleepyTime()));
foodButton.setText("Awake");
buddy.setSleeping(false);
}
}