title: How do i set Repeating Alarm for user selected days?
body: <p><strong>Condition :</strong>
  User selects a active time period (from  and to) for a day within which the alarm should be active with user specified interval.
  User selects a inactive time period (from  and to) for a day within which the alarm should be inactive or silent.
  User selects the days on which the alarm should be fired.</p>
  
  <p>eg: a user selects the active period of the alarm to be 9:00 am to 6:00pm with an interval of 20 minutes.
  and he don't want the alarm to notify during his break time.say lunch break time is from 1:00 pm to 2:00 pm.He wasnts the alarm to be active only on Tuesday,Thursday and Sunday.
  So during Tuesday, Thursday and Sunday ,the alarm should fire at 9:00am and fire with an interval of 20 minutes till 6:00pm. In between the alarm should be silent for 1:00pm to 2:00pm.</p>
  
  <p>The user sets the timings in the main activity and the alarm for those timings is set in another activity where the alarm can be set and canceled.</p>
  
  <p><strong>Variables:</strong></p>
  
  <p>Active from time(in millisec) : int AFrom</p>
  
  <p>Active to time (in millisec) : int ATo</p>
  
  <p>Break from time (in millisec) : int BFrom</p>
  
  <p>Break to time (in millisec) : int Bto</p>
  
  <p>Alarm firing Interval (in millisec)  : int interval</p>
  
  <p>To select no: of days using a Android Alert Dialog with Multiple checkboxes: </p>
  
  <pre><code>String days[] = {"MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY","SUNDAY"} ;
  Boolean checkedDays[] = {false,true,false,true,false,true,false};
  final ArrayList DaysSelected = new ArrayList();
  </code></pre>
  
  <p>(this is just for information. Actual working Dialog box is created already. Just want to use the selected day's index for checking with the calendar day)</p>
  
  <p>days[] is referenced with checkedDays[] to identify the selected days in setMultiChoiceItems().</p>
  
  <p><strong>Inside setMultiChioceItems():</strong></p>
  
  <pre><code>builder.setMultiChoiceItems(days, checkedDays,
                  new DialogInterface.OnMultiChoiceClickListener() {
  
  
                      @Override
             public void onClick(DialogInterface dialog, int selectedItemId,
                                          boolean isSelected) {
                          if (isSelected) {
  
                              DaysSelected .add(selectedItemId);
                          } else if (DaysSelected .contains(selectedItemId)) {
  
                           DaysSelected .remove(Integer.valueOf(selectedItemId));
                          }
                      }
                  })
  </code></pre>
  
  <p>Alarm has to be set for the days whose checkedDays[] values are true</p>
  
  <p><strong>Note :All the variables all set static to use across all activities.</strong></p>
  
  <p>with the above variables how do I fire the below alarm for my above required condition?</p>
  
  <pre><code>    Intent intent = new Intent(this,Notifier.class);
      PendingIntent pendingIntent = PendingIntent.getActivitythis.getApplicationContext(),
                   12345, intent, FLAG_CANCEL_CURRENT );
      AlarmManager am =(AlarmManager)getSystemService(Activity.ALARM_SERVICE);
      am.setRepeating(AlarmManager.RTC_WAKEUP, AT_from , interval, pendingIntent);
  </code></pre>