title: How to set alarm on android studio?
body: <p>I really need help guys , i'm trying to make a toast appear at a specific time with the alarm manager from android . I made some research and i made this code , but i don't know what isn't ok ... I tried everything</p>
  
  <pre><code>public void start() {
          AlarmManager manager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
          Date dat = new Date();
          Calendar cal_alarm = Calendar.getInstance();
          Calendar cal_now = Calendar.getInstance();
          cal_now.setTime(dat);
          cal_alarm.setTime(dat);
          cal_alarm.set(Calendar.HOUR_OF_DAY,12);
          cal_alarm.set(Calendar.MINUTE,13);
          cal_alarm.set(Calendar.SECOND,0);
          if(cal_alarm.before(cal_now)){
              cal_alarm.add(Calendar.DATE,1);
          }
          manager.set(AlarmManager.RTC_WAKEUP,cal_alarm.getTimeInMillis(),pendingIntent);
      }
  </code></pre>
  
  <p>If i use cal_alarm - cal_now in manager.set it fires off after 5 seconds . </p>