ループステートメントからの文字列のリストがあり、それを ArrayList にしてから文字列を個別に呼び出す方法がわかりません。これがwhileステートメントです:
try {
toDate=format.parse(str4);
java.util.Date newValue= new SimpleDateFormat(OLD_FORMAT).parse(str4);
String newValue2 = new SimpleDateFormat(NEW_FORMAT).format(newValue);
// System.out.println(newValue2);
} catch (ParseException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
//change the format of toDate
try {
newDateString=format.parse(str5);
java.util.Date newqwe = new SimpleDateFormat(OLD_FORMAT).parse(str5);
String newqwe2=new SimpleDateFormat (NEW_FORMAT).format(newqwe);
//System.out.println(newqwe2);
} catch (ParseException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
//get the days between two dates then print it
Calendar cal2 = Calendar.getInstance();
cal2.setTime(toDate);
while (cal2.getTime().before(newDateString)) {
cal2.add(Calendar.DATE, 1);
String datelist=(format.format(cal2.getTime()));
str4 は、str5 と同じ日付のラベルからのものです。ボタンをクリックすると、ループ ステートメントの文字列は次のようになります。
2013-05-03
2013-05-04
2013-05-05
2013-05-05
2013-05-06
2013-05-07
2013-05-08
2013-05-09
2013-05-10
2013-05-11
2013-05-12
2013-05-13
2013-05-14
2013-05-15
2013-05-16
2013-05-17