遞增日期值//好吧,我已經經歷了這麼多的教程走了,但coudlnt找到我的事情,所以我在這裏把我的查詢 我有兩個DatePicker
FromDate
和ToDate
我要的是當用戶selext日期應該進來日期的String Array
想我的日期是Start_Date="1/09/2012"
我要填寫陣列像填充陣列中的Android
String[] Date Arrau= {"1/09/2012","2/09/2012","3/09/2012","4/09/2012"}
我所做的是
DateDifference=Integer.parseInt(EndDate)-Integer.parseInt(StartDate);
SimpleDateFormat sdf= new SimpleDateFormat("dd-MM-yyyy");
Date myDate= null;
try {
myDate= sdf.parse(StartDate);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Date newFirstDate= new Date(myDate.getDate()); // 7 * 24 * 60 * 60 * 1000
for(int i=0;i<=DateDifference;i++){
Calendar c= Calendar.getInstance();
c.setTime(newFirstDate);
c.add(Calendar.DATE, 1);
Date newDate= c.getTime();
DateArray[i]=newDate.toString();
}
我得到一個空指針異常錯誤
它給我錯誤請幫助!
請註明你所得到的錯誤!而你的問題是不明確的。你對Start_Date對象意味着什麼?你究竟想要什麼。請完善你的問題。 – Hiral
@手機請查看我更新的問題 –