title: Android - how to set an alarm to a specific date
body: <p>I have seen a lot of tutorials and been trying for 2 hours now , though something is still wrong. I am very nervous now :) I want to set an alarm e.g. to 16:25 to go off, but nothing happens. I have this code:</p>
  
  <pre><code>   Calendar cur_cal = new GregorianCalendar();
      cur_cal.setTimeInMillis(System.currentTimeMillis());
  
      Calendar cal = new GregorianCalendar();
      cal.add(Calendar.DAY_OF_YEAR, cur_cal.get(Calendar.DAY_OF_YEAR));
      cal.set(Calendar.HOUR_OF_DAY, 16);
      cal.set(Calendar.MINUTE, 25);
      cal.set(Calendar.SECOND, 0);
      cal.set(Calendar.MILLISECOND, 0);
  
      alarmManager.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), pendingIntent);
  </code></pre>
  
  <p>I have also tried this:</p>
  
  <pre><code> cal.set(Calendar.AM_PM, cur_cal.get(Calendar.AM_PM));
      cal.set(Calendar.HOUR, 4);
  </code></pre>
  
  <p>My final goal is to make it a repeating alarm, e.g. it should go off every day at the set time.</p>
  
  <p>Update 01.17.2011. Still not working. I have this code:</p>
  
  <pre><code>           Calendar cal = Calendar.getInstance();
              cal.set(Calendar.YEAR, 2011);
              cal.set(Calendar.MONTH, Calendar.JANUARY); 
              cal.set(Calendar.DAY_OF_MONTH, 17);
              cal.set(Calendar.HOUR_OF_DAY, 16);
              cal.set(Calendar.MINUTE, 58);
           cal.set(Calendar.SECOND, 0);
            cal.set(Calendar.MILLISECOND, 0);
  </code></pre>
  
  <p>I have also tried this:</p>
  
  <pre><code> cal.set(Calendar.HOUR, 4);
   cal.set(Calendar.AM_PM, Calendar.PM);
  </code></pre>
  
  <p>and this:</p>
  
  <pre><code>cal.set(Calendar.HOUR_OF_DAY, 4 );
              cal.set(Calendar.AM_PM, Calendar.PM);
  </code></pre>