0

How do I increment the variable DOW by 1 each new day?

So it would be:

monday dow = 1;
tuesday dow = 2;
wednesday dow = 3
thursday dow = 4;
friday dow = 5;
saturday dow = 6;
sunday down = 7; 
monday dow = 8;

and it wont reset until it gets to 365 (1 Year), then once I have this variable, I can use it in this;

     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]);
        }
MrJoshFisher
  • 1,143
  • 5
  • 21
  • 48

1 Answers1

0
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]);

        }
Taryn
  • 242,637
  • 56
  • 362
  • 405
MrJoshFisher
  • 1,143
  • 5
  • 21
  • 48
  • I have found a solution to my problem using this i can use the int year in this: quote.settext(list[year]); so in turn every day will get a different quote – MrJoshFisher Jun 22 '14 at 17:21