如何每天将变量DOW加1?
因此它将是:
monday dow = 1;
tuesday dow = 2;
wednesday dow = 3
thursday dow = 4;
friday dow = 5;
saturday dow = 6;
sunday down = 7;
monday dow = 8;
并且直到达到365(1年)后它才会重置,一旦有了此变量,就可以在其中使用它了;
int dow = 0;
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
counter++;
if (counter >= list.length)
counter = 0;
quote.setText(list [dow]);
}
Calendar calendar = Calendar.getInstance();
int doy = calendar.get(Calendar.DAY_OF_YEAR);
// int doy gives me the result 174 which is the day of year so it sets the quote text to string array number 174.
@Override
public void onClick(View v) {
title.setText("Quote of the day:");
quote.setText(list [doy]);
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句