title: Android Calendar DAY_OF_WEEK returned '1' for monday... but only once?
body: <p>I have an app that uses alarms to start radio streams. It has a 'repeat daily' function. To check if the alarm should fire on a particular day I check if 'DAY_OF_WEEK' is in an array. Something like this:</p>
  
  <pre><code>int[] repeatOnDays = [0,1,1,1,1,1,1]; // first nr is sunday, last is saturday
  int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK)-1; // -1 because Sunday==1 but its index in the array is 0
  if (repeatOnDays[dayOfWeek]&gt;0) { /* FIRE ALARM TODAY */ }
  else { /* DON'T FIRE ALARM TODAY */ }
  </code></pre>
  
  <p>(Note: above code may not be 100% java, I've simplified stuff)</p>
  
  <p>This morning, when my code ran, it said dayOfWeek was '0' (Sunday) but it's Monday! And when I set another alarm it suddenly said dayOfWeek was '1'.</p>
  
  <p>Wth? How can this happen?</p>
  
  <p>// UPDATE: Here's the actual code:</p>
  
  <pre><code>JSONArray repeatDaily = new JSONArray("[0,1,1,1,1,1,1]"); // &lt;- This is not actually here but it may help read the rest of the code :)
  
  boolean fireToday = true;
  if (repeat.equals("daily")) {
      Log.d(APPTAG," &gt; Daily repeat..");
      int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK)-1;
      if (repeatDaily.length()&lt;dayOfWeek) { fireToday = false; }
      else if (repeatDaily.getInt(dayOfWeek)&gt;0) { fireToday = true; }
      else { fireToday = false; }
      Log.d(APPTAG," &gt; Day: "+ dayOfWeek +", "+ repeatDaily.getInt(dayOfWeek));
  }
  if (!fireToday) { 
      Log.d(APPTAG," &gt; Do not need to fire today");
      return; // &lt;-- important stuff
  }
  </code></pre>
  
  <p>Logcat:</p>
  
  <pre><code>06:30:01    D/AlarmMgr  &gt; Daily repeat..
  06:30:01    D/AlarmMgr  &gt; Day: 0, 0
  06:30:01    D/AlarmMgr  &gt; Do not need to fire today
  </code></pre>